<reponame>bjerrep/zyglot
#!/usr/bin/env python3
import argparse
import traceback
from log import logger as log
from log import inf, cri
from errorcodes import ErrorCode
import logging
import app

parser = argparse.ArgumentParser('zyglot, a simple python cli template (with colored logging)')
parser.add_argument('--verbose', action='store_true',
                    help='enable debug messages')
args = parser.parse_args()

if args.verbose:
    log.setLevel(logging.DEBUG)

try:
    errcode = app.app(args)
    if errcode != ErrorCode.OK:
        cri('critical message', errcode)
except Exception as e:
    if args.verbose:
        print(traceback.format_exc())
    cri(f'caught exception {e}', ErrorCode.UNHANDLED_EXCEPTION)


inf('exiting')

#!/usr/bin/env python3
import argparse
import traceback
from log import logger as log
from log import inf, cri
from errorcodes import ErrorCode
import logging
import app

parser = argparse.ArgumentParser('zyglot, a simple python cli template (with colored logging)')
parser.add_argument('--verbose', action='store_true',
                    help='enable debug messages')
args = parser.parse_args()

if args.verbose:
    log.setLevel(logging.DEBUG)

try:
    errcode = app.app(args)
    if errcode != ErrorCode.OK:
        cri('critical message', errcode)
except Exception as e:
    if args.verbose:
        print(traceback.format_exc())
    cri(f'caught exception {e}', ErrorCode.UNHANDLED_EXCEPTION)


inf('exiting')
#!/usr/bin/env python3