Ejemplo n.º 1
0
def run_from_cmdline():
    parser = make_parser()
    options, args = parse_options(parser)
    config = parse_config(options.config)
    db = Database(options.timebook, config)
    cmd, args = args[0], args[1:]
    try:
        run_command(db, cmd, args)
    except NoMatch, e:
        parser.error('%s' % e.args[0])
Ejemplo n.º 2
0
def run_from_cmdline(argv=[]):
    args = parse_args(argv)
    config = parse_config(os.path.expanduser(args['--config']))
    db = Database(os.path.expanduser(args['--timebook']), config)
    cmd, args = args['<command>'], args['<args>']
    try:
        run_command(db, cmd, args)
    except NoMatch as e:
        raise SystemExit(e.args[0])
    except AmbiguousLookup as e:
        raise SystemExit('%s\n    %s' % (e.args[0], ' '.join(e.args[1])))
Ejemplo n.º 3
0
def run_from_cmdline():
    parser = make_parser()
    options, args = parse_options(parser)
    config = parse_config(options.config)
    db = Database(options.timebook, config)
    cmd, args = args[0], args[1:]
    try:
        run_command(db, cmd, args)
    except NoMatch as e:
        parser.error('%s' % e.args[0])
    except AmbiguousLookup as e:
        parser.error('%s\n    %s' % (e.args[0], ' '.join(e.args[1])))
    except CommandError as e:
        parser.error("%s" % e)