cucchiaiata/script/cucchiaiata-cli

31 lines
788 B
Python
Executable File

#!/usr/bin/python3
"""Zephir-cmd-input script
"""
from sys import exit, argv
from json import dumps
from traceback import print_exc
from cucchiaiata import Parser, config, Configuration
from cucchiaiata.i18n import _
def main():
try:
if len(argv) > 2 and argv[1] in ['v1.setting.session.server.configure',
'v1.setting.session.servermodel.configure']:
Configuration().get()
else:
parser = Parser()
print(dumps(parser.get(),
indent=config.indent))
except KeyboardInterrupt:
pass
except Exception as err:
if config.debug:
print_exc()
print(_('Error: {}').format(err))
exit(1)
if __name__ == "__main__":
main()