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


Python ArghParser.add_commands方法代码示例

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


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

示例1: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    l18n.init()

    parser = ArghParser()
    parser.add_argument('-a', '--auth',
                        action='store_true',
                        help=_('Authenticate and show all problems'
                               ' on this machine'))

    parser.add_argument('-v', '--version',
                        action='version',
                        version=config.VERSION)

    parser.add_commands([
        backtrace,
        di_install,
        gdb,
        info,
        list_problems,
        remove,
        report,
        retrace,
        status,
    ])

    argcomplete.autocomplete(parser)

    try:
        parser.dispatch()
    except KeyboardInterrupt:
        sys.exit(1)

    sys.exit(0)
开发者ID:abrt,项目名称:abrt,代码行数:35,代码来源:cli.py

示例2: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    ''' The main method of Barman '''
    p = ArghParser()
    p.add_argument('-v', '--version', action='version', version=barman.__version__)
    p.add_argument('-c', '--config', help='uses a configuration file (defaults: $HOME/.barman.conf, /etc/barman.conf)')
    p.add_argument('-q', '--quiet', help='be quiet', action='store_true')
    p.add_commands(
        [
            cron,
            list_server,
            show_server,
            status,
            check,
            backup,
            list_backup,
            show_backup,
            list_files,
            recover,
            delete,
        ]
    )
    try:
        p.dispatch(pre_call=global_config, output_file=_output_stream)
    except Exception:
        msg = "ERROR: Unhandled exception. See log file for more details."
        logging.exception(msg)
        raise SystemExit(msg)
开发者ID:klhochhalter,项目名称:barman,代码行数:29,代码来源:cli.py

示例3: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
	parser = ArghParser()

	parser.add_commands(
		(
			module_list,
			module_install,
			module_uninstall,
			module_enable,
			module_disable
		),
		namespace='module',
		title='Module commands',
		description='Group of commands related to listing or (un)installing modules'
	)

	ini_file='production.ini'
	if 'NP_INI_FILE' in os.environ:
		ini_file = os.environ['NP_INI_FILE']

	ini_name='netprofile'
	if 'NP_INI_NAME' in os.environ:
		ini_name = os.environ['NP_INI_NAME']

	parser.add_argument('--ini-file', '-i', default=ini_file, help='Specify .ini file to use')
	parser.add_argument('--application', '-a', default=ini_name, help='Default app section of .ini file to use')

	parser.dispatch()
开发者ID:baloon11,项目名称:npui,代码行数:30,代码来源:ctl.py

示例4: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    logging_helper.logging_config(detail="high")
    parser = ArghParser()
    parser.add_commands([
        remove_missing_seqs
        ]
        )
    parser.dispatch()
开发者ID:andreyto,项目名称:YAP,代码行数:10,代码来源:mothur_edit.py

示例5: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for manipulating FASTA files")
    parser.add_commands([
        rec_filter
        ]
        )
    parser.dispatch()
开发者ID:andreyto,项目名称:mgtaxa,代码行数:10,代码来源:fasta_util.py

示例6: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main(argv=None):
    """ Main method / entry point """
    if argv is None:
        argv = sys.argv[1:]
    description = "SSL Karttarekisteri KML tool"
    parser = ArghParser(description=description)
    parser.add_commands([convert, download])
    parser.dispatch(argv=argv)
开发者ID:jvtm,项目名称:sslkml,代码行数:10,代码来源:conv.py

示例7: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for working with tabular files")
    parser.add_commands([
        filter_rows
        ]
        )
    parser.dispatch()
开发者ID:andreyto,项目名称:mgtaxa,代码行数:10,代码来源:tab_util.py

示例8: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    """Use argh to dispatch to your subcommands."""
    from argh import ArghParser  # sudo apt-get install python3-argh
    parser = ArghParser()
    # Sorting makes the output of --help better:
    parser.add_commands(sorted(subcommand.s, key=lambda f: f.__name__))
    # parser.add_commands(subcommand.s)
    parser.dispatch()
开发者ID:nandoflorestan,项目名称:bag,代码行数:10,代码来源:subcommand.py

示例9: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for analysing output of annotation consensus classifier")
    parser.add_commands([
        as_tab
        ]
        )
    parser.dispatch()
开发者ID:andreyto,项目名称:mgtaxa,代码行数:10,代码来源:annot_cons_util.py

示例10: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    reload(sys)
    sys.setdefaultencoding("utf-8")
    
    parser = ArghParser(description='Simple static gallery generator.')
    parser.add_commands([init, build, serve])
    parser.add_argument('--version', action='version',
                        version='%(prog)s {}'.format(__version__))
    parser.dispatch()
开发者ID:Galland,项目名称:sigal,代码行数:11,代码来源:__init__.py

示例11: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    """
    Main entrypoint for console_script (commandline script)
    """
    parser = ArghParser()
    parser.add_argument('-v', '--version', action='version', version=client_version)
    enabled_commands = [pull, push]
    
    parser.add_commands(enabled_commands)
    parser.dispatch()
开发者ID:sveetch,项目名称:PO-Projects-client,代码行数:12,代码来源:cli.py

示例12: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    """
    Main entrypoint for console_script (commandline script)
    """
    parser = ArghParser()
    parser.add_argument("-v", "--version", action="version", version=client_version)
    enabled_commands = [register]

    parser.add_commands(enabled_commands)
    parser.dispatch()
开发者ID:sveetch,项目名称:Gestus-client,代码行数:12,代码来源:cli.py

示例13: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    from snaptastic import __version__
    if '--version' in sys.argv:
        print 'Snaptastic version %s' % __version__

    p = ArghParser()
    commands = [make_snapshots, mount_snapshots, check_backups,
                list_volumes, unmount_snapshots, clean, test]
    p.add_commands(commands)
    p.dispatch()
开发者ID:mikery,项目名称:Snaptastic,代码行数:12,代码来源:cli.py

示例14: __call__

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
    def __call__(self, **kwargs):
        parser = ArghParser()
        commands = [
            full_release,
            publish_cfg_files,
            update_distribution_changelog,
        ]

        parser.add_commands(commands)
        parser.dispatch()
开发者ID:derFreitag,项目名称:freitag.releaser,代码行数:12,代码来源:manage.py

示例15: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import add_commands [as 别名]
def main():
    commands = pack, watch, shell, libs
    names = [f.__name__ for f in commands] + [ 'help' ]

    parser = ArghParser()
    parser.add_argument('-v', '--version', action='version', version=VERSION, help='Show zeta version')
    parser.add_commands(commands)
    argv = sys.argv[1:]
    if argv and not argv[0] in names and not argv[0] in ['-v', '--version']:
        argv.insert(0, 'pack')
    parser.dispatch(argv)
开发者ID:bhunter,项目名称:zeta-library,代码行数:13,代码来源:main.py


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