cucchiaiata/script/cucchiaiata-cli

32 lines
763 B
Plaintext
Raw Normal View History

2019-11-29 09:02:10 +01:00
#!/usr/bin/env python3
"""Zephir-cmd-input script
"""
2019-12-02 10:30:29 +01:00
from sys import exit, argv
from json import dumps
2019-11-29 09:02:10 +01:00
from traceback import print_exc
2019-12-02 10:30:29 +01:00
from cucchiaiata import Parser, config, Configuration
2019-11-29 09:02:10 +01:00
from cucchiaiata.i18n import _
def main():
try:
2020-03-10 12:21:49 +01:00
if argv[1] in ['setting.session.server.configure',
'setting.session.servermodel.configure']:
2019-12-02 10:30:29 +01:00
Configuration().get()
else:
parser = Parser()
print(dumps(parser.get(),
indent=config.indent))
2019-11-29 09:02:10 +01:00
except Exception as err:
if config.debug:
print_exc()
print(_('Error: {}').format(err))
exit(1)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass