Ejemplo n.º 1
0
def main():
    cli.init()
    session = PromptSession()

    while True:
        try:
            active_user = manager.get_active_account()
            prompt_text = "> "

            if active_user:
                prompt_text = "{}> ".format(active_user.master_name)

            text = session.prompt(prompt_text)

            terminate = cli.handle(text)

            if terminate:
                break

        except KeyboardInterrupt as e:
            continue

        except EOFError:
            cli.handle('close')
            break
Ejemplo n.º 2
0
def main():
    args = docopt(__doc__, version='4.0.2')
    _setup_logging(args['--verbose'])
    _add_global_error_handler()

    if args['garage'] and args['open']:
        startfile(dirname(cli.init()))

    if args['config']:
        if args['init']:
            message = cli.init()
            print('config file: {}'.format(message))

        if args['repos'] and args['<repo>']:
            if args['--add']:
                message = cli.add_repo(args['<repo>'])

            if args['--remove']:
                message = cli.remove_repo(args['<repo>'])

            print(message)

        if args['set'] and args['<key>'] and args['<value>']:
            message = config.set_config_prop(args['<key>'], args['<value>'])
            print(message)

        if args['repos'] and args['--list']:
            for folder in cli.list_repos():
                print(folder)
    elif args['list-pallets']:
        pallets = cli.list_pallets()

        if len(pallets) == 0:
            print('No pallets found!')
        else:
            for plug in pallets:
                print(': '.join(plug))
    elif args['git-update']:
        cli.git_update()
    elif args['lift']:
        if args['<file-path>']:
            if args['--pallet-arg']:
                cli.start_lift(args['<file-path>'], args['<arg>'])
            else:
                cli.start_lift(args['<file-path>'])
        else:
            cli.start_lift()
    elif args['speedtest']:
        cli.speedtest(speedtest)

    shutdown()