Esempio n. 1
0
def autocomplete():

    cwords, prev, curr = utils.get_cwords()

    choices = _get_current_choices(utils.get_commands(), cwords, prev, curr)

    print ' '.join(filter(lambda x: x.startswith(curr), [utils.shellquote(c) for c in choices]))

    sys.exit(1)
Esempio n. 2
0
def execute_from_command_line():

    # Catch set commandset on commandline before invoking parser. Status: workaround
    has_commandset_arg = map(lambda x: x in ['-c', '--commandset'], sys.argv)
    if any(has_commandset_arg):
        CS = sys.argv[has_commandset_arg.index(True) + 1]
        if CS in get_commandsets():
            get_active_commandset(CS)

    # has_any_positional_command = map(lambda x: not x.startswith('-'), sys.argv[1:])
    # if not any(has_any_positional_command):
    #     s = get_active_settings_module()
    #     if hasattr(s, 'DEFAULT_SUBCOMMAND'):
    #         sys.argv.append(s.DEFAULT_SUBCOMMAND)

    # Patched pythons argparse in lib, because of http://bugs.python.org/issue9351
    parser = argparse.ArgumentParser(description='%s' % get_active_commands_description())

    _add_subcommands_and_arguments(get_commands(), None, parser)

    parser_args = parser.parse_args()

    parser_args.func(parser_args)
Esempio n. 3
0
def ugo_info(args):
    print get_commands()