当前位置: 首页>>代码示例>>Python>>正文


Python argcomplete.autocomplete方法代码示例

本文整理汇总了Python中argcomplete.autocomplete方法的典型用法代码示例。如果您正苦于以下问题:Python argcomplete.autocomplete方法的具体用法?Python argcomplete.autocomplete怎么用?Python argcomplete.autocomplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在argcomplete的用法示例。


在下文中一共展示了argcomplete.autocomplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def main():
    """Main CLI application."""

    parser = get_parser()

    argcomplete.autocomplete(parser, always_complete_options=False)

    args = parser.parse_args()
    if not args.command:
        args.command = "aggregate"

    setup_logger(
        level=args.log_level
    )

    try:
        run(args)
    except KeyboardInterrupt:
        pass 
开发者ID:acsone,项目名称:git-aggregator,代码行数:21,代码来源:main.py

示例2: list_module_options

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def list_module_options(module, module_name):

    config = get_config_options()
    db = initialize_database(config)
    # Load the module
    Module = load_module(module)
    if Module.Module.__doc__:
        print("%s" % module_name)

        print(Module.Module.__doc__)
    m = Module.Module(db)

    # Populate the options
    m.set_options()
    argcomplete.autocomplete(m.options)
    m.options.parse_args(["-h"]) 
开发者ID:depthsecurity,项目名称:armory,代码行数:18,代码来源:armory.py

示例3: list_report_options

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def list_report_options(module, module_name):

    config = get_config_options()
    db = initialize_database(config)
    # Load the module
    Module = load_module(module)
    if Module.Report.__doc__:
        print("%s" % module_name)

        print(Module.Report.__doc__)

    m = Module.Report(db)

    # Populate the options
    m.set_options()
    argcomplete.autocomplete(m.options)
    m.options.parse_args(["-h"]) 
开发者ID:depthsecurity,项目名称:armory,代码行数:19,代码来源:armory.py

示例4: start

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def start(self, run_args=None):
        """ Starts a command and registers single handlers.

        Args:
            run_args (:class:`list`): the list of run arguments. If None we use sys.argv[1:].
        """
        if run_args is None:
            run_args = sys.argv[1:]

        parser = self._get_arg_parser()
        argcomplete.autocomplete(parser)

        if self.parse_unknown_args:
            args, unknown = parser.parse_known_args(run_args)
            self.run(args, unknown)
        else:
            args = parser.parse_args(run_args)
            self.run(args, {}) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:20,代码来源:shell_utils.py

示例5: _create_shell

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def _create_shell(crate_hosts, error_trace, output_writer, is_tty, args,
                  timeout=None, password=None):
    return CrateShell(crate_hosts,
                      error_trace=error_trace,
                      output_writer=output_writer,
                      is_tty=is_tty,
                      autocomplete=args.autocomplete,
                      autocapitalize=args.autocapitalize,
                      verify_ssl=args.verify_ssl,
                      cert_file=args.cert_file,
                      key_file=args.key_file,
                      ca_cert_file=args.ca_cert_file,
                      username=args.username,
                      password=password,
                      schema=args.schema,
                      timeout=timeout) 
开发者ID:crate,项目名称:crash,代码行数:18,代码来源:command.py

示例6: parse_commands

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def parse_commands(argv):
    """
    parse the input command
    """
    # 首先创建一个ArgumentParser对象
    parser = argparse.ArgumentParser(description="FISCO BCOS 2.0 lite client @python")
    parsed_args = argparse.Namespace()
    cmd = parser.add_argument("cmd", nargs="+", help="the command for console")  # 添加参数
    cmd.completer = completion

    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    print("\nINFO >> user input : {}\n".format(args.cmd))
    cmd = args.cmd[0]
    inputparams = args.cmd[1:]
    return cmd, inputparams 
开发者ID:FISCO-BCOS,项目名称:python-sdk,代码行数:19,代码来源:console.py

示例7: __call__

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def __call__(self, args=None):
        if args is None:
            args = sys.argv[1:]
        if argcomplete:
            argcomplete.autocomplete(self.parser, exclude=['-P'])
        elif 'COMP_LINE' in os.environ:
            return 0
        sys.excepthook = self.handle
        args = self.read_configuration(args)
        args = self.parser.parse_args(args)
        self.configure_logging(args)
        if args.debug:
            try:
                import pudb
            except ImportError:
                pudb = None
                import pdb
            return (pudb or pdb).runcall(self.main, args)
        else:
            return self.main(args) or 0 
开发者ID:waveform-computing,项目名称:compoundpi,代码行数:22,代码来源:terminal.py

示例8: main

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def main():
    try:
        argv = sys.argv[1:]
        conf   = Config()
        parser = arguments.get_root_parser(conf)
        argcomplete.autocomplete(parser)

        try:
            args = parser.parse_args(argv)
        except TypeError:
            args = parser.parse_args(argv + ["-h"])

        getattr(args.cmd(conf, args), args.fn)()
    except Exception as e:
        if (sys.argv[1] == "--print-traceback"):
            raise
        else:
            print("Error:", e)
            print("If you want to see full Traceback then run:")
            print("snet --print-traceback [parameters]")
            sys.exit(42) 
开发者ID:singnet,项目名称:snet-cli,代码行数:23,代码来源:__init__.py

示例9: main

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def main():
  parser = argparse.ArgumentParser(description=__doc__)
  setup_argparse(parser)
  try:
    import argcomplete
    argcomplete.autocomplete(parser)
  except ImportError:
    pass
  args = parser.parse_args()

  thisdir = os.path.abspath(os.path.dirname(__file__))
  jenv = jinja2.Environment(
      loader=jinja2.FileSystemLoader(thisdir)
  )

  if args.command == "properties":
    get_properties(args, jenv)
  elif args.command == "variables":
    get_variables(args, jenv)
  elif args.command == "usages":
    cmd_get_usages(args, jenv)
  elif args.command == "deprecated":
    cmd_print_deprecated(args, jenv)
  else:
    logger.warning("Unknown command %s", args.command) 
开发者ID:cheshirekow,项目名称:cmake_format,代码行数:27,代码来源:parse_cmake_help.py

示例10: parse_args

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def parse_args(self):
        """Parse the CLI args.
        """
        if self.args:
            self.log.debug('Warning: Arguments have already been parsed, ignoring duplicate attempt!')
            return

        argcomplete.autocomplete(self._arg_parser)

        self.acquire_lock()
        self.args = self._arg_parser.parse_args()

        if 'entrypoint' in self.args:
            self._entrypoint = self.args.entrypoint

        self.release_lock() 
开发者ID:qmk,项目名称:qmk_cli,代码行数:18,代码来源:milc.py

示例11: m2cpp

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def m2cpp(args=None):
    """
    Execute main parser.

    Args:
        args (Optional[List[str]]):
            Argument to be parsed. If omitted, use ``sys.args``.
    """
    parser = create_parser()
    if argcomplete is not None:
        argcomplete.autocomplete(parser)

    args = parser.parse_args(args)

    from matlab2cpp.frontend import execute_parser
    execute_parser(args) 
开发者ID:jonathf,项目名称:matlab2cpp,代码行数:18,代码来源:__init__.py

示例12: enable_autocomplete

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def enable_autocomplete(self, parser):
        if self.cli_ctx.data['completer_active']:
            argcomplete.autocomplete = argcomplete.CompletionFinder()
            argcomplete.autocomplete(parser, validator=lambda c, p: c.lower().startswith(p.lower()),
                                     default_completer=lambda _: ()) 
开发者ID:microsoft,项目名称:knack,代码行数:7,代码来源:completion.py

示例13: parse_args

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def parse_args():
    parser = argparse.ArgumentParser(description=__doc__, epilog=_epilog)
    parser.add_argument(
        "--debug", action="store_true", help="include dump of all data returned"
    )
    parser.add_argument("--owners", action="store_true", help="Also show owners")
    parser.add_argument("--email", action="store_true", help="include owner email")
    parser.add_argument(
        "--all-my-orgs",
        action="store_true",
        help="act on all orgs for which you're an owner",
    )
    parser.add_argument(
        "--names-only",
        action="store_true",
        help="Only output your org names for which you're an owner",
    )
    parser.add_argument(
        "orgs", nargs="*", help="github organizations to check (defaults to " "mozilla)"
    )
    argcomplete.autocomplete(parser)
    args = parser.parse_args()
    if args.names_only:
        args.all_my_orgs = True
        if args.owners or args.email:
            parser.error("Can't specify owners or emails with --all-my-orgs")
    if args.all_my_orgs and len(args.orgs):
        parser.error("Can't specify orgs with --all-my-orgs")
    if args.email and not args.owners:
        # implies owners
        args.owners = True
    if args.debug:
        global DEBUG
        DEBUG = args.debug
    return args


# api.github.com/user/orgs endpoint not natively supported
# belongs in authenticated user 
开发者ID:mozilla,项目名称:github-org-scripts,代码行数:41,代码来源:get_org_info.py

示例14: run_report

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def run_report(Report, argv, report):
    # Get the basic settings and database set up

    config = get_config_options()
    db = initialize_database(config)

    m = Report.Report(db)

    # Populate the options
    m.set_options()

    # A bunch of fun stuff to check if arguments provided on command line
    # and override config file if found.
    # module_config_data = get_config_options(module + '.ini')
    # if 'ModuleSettings' in module_config_data.sections():
    #     module_opt_keys = [a.option_strings for a in m.options._actions]
    #     for k in module_config_data['ModuleSettings'].keys():

    #         for o in module_opt_keys:

    #             if k in [a.replace('-', '') for a in o]:
    #                 exists = False
    #                 for n in o:
    #                     if n in argv:
    #                         exists = True
    #                 if not exists:

    #                     argv.append("--" + k)
    #                     argv.append(module_config_data['ModuleSettings'][k])

    argcomplete.autocomplete(m.options)
    args, unknown = m.options.parse_known_args(argv)
    m.base_config = config

    m.run(args) 
开发者ID:depthsecurity,项目名称:armory,代码行数:37,代码来源:armory.py

示例15: parse_args

# 需要导入模块: import argcomplete [as 别名]
# 或者: from argcomplete import autocomplete [as 别名]
def parse_args():
    parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter, description= \
        "Usage: python passmaker.py <OPTIONS> \n")

    menu_group = parser.add_argument_group('Menu Options')

    menu_group.add_argument('-o', '--output', help="password dict file", default=None)
    menu_group.add_argument('-i', '--interactive', help="interactive mode",action='store_true',default=False)
    menu_group.add_argument('-g', '--gui', help="GUI mode", action='store_true', default=False)

    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    return args 
开发者ID:bit4woo,项目名称:passmaker,代码行数:16,代码来源:passmaker.py


注:本文中的argcomplete.autocomplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。