本文整理汇总了Python中argh.ArghParser.dispatch方法的典型用法代码示例。如果您正苦于以下问题:Python ArghParser.dispatch方法的具体用法?Python ArghParser.dispatch怎么用?Python ArghParser.dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类argh.ArghParser
的用法示例。
在下文中一共展示了ArghParser.dispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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)
示例2: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例3: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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)
示例4: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [as 别名]
def main():
logging_config(detail="high")
parser = ArghParser(description="Utilities for manipulating FASTA files")
parser.add_commands([
rec_filter
]
)
parser.dispatch()
示例5: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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)
示例6: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [as 别名]
def main():
logging_config(detail="high")
parser = ArghParser(description="Utilities for working with tabular files")
parser.add_commands([
filter_rows
]
)
parser.dispatch()
示例7: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例8: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例9: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [as 别名]
def main():
logging_helper.logging_config(detail="high")
parser = ArghParser()
parser.add_commands([
remove_missing_seqs
]
)
parser.dispatch()
示例10: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例11: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例12: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例13: __call__
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [as 别名]
def __call__(self, **kwargs):
parser = ArghParser()
commands = [
full_release,
publish_cfg_files,
update_distribution_changelog,
]
parser.add_commands(commands)
parser.dispatch()
示例14: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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()
示例15: main
# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import dispatch [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)