argdeclare是用于python的argparse的声明性参数配置器。
argdeclare的Python项目详细描述
#ardeclare
CMDLN模块提供的接口实现,但
使用argparse提供选项/arg重解析。
最初发现的代码是:argdeclare:argparse的声明性接口(http://code.activestate.com/recipes/576935 argdeclare-declare-declarative-interface-to-argparse/)
arg
def test():
仅适用于在不同函数之间重复的选项
common_options=option_group(
option('-t','--type',action='store',help='specify type of package'),
arg('package',help='package to be(un)installed'),
option('--log','-l',,action='store_true',help='log is on')
)
类应用程序(commander):
'测试应用程序的说明'
名称='app1'
版本='0.1'
默认参数=['install','--help']
@选项('--log','-l',action='store_true',help=“log is on”)
@arg('pattern',help=“pattern to delete”)
def do_delete(self,options):
“delete subcmd的帮助文本”
打印(options)
@option('-f','--force',action='store_true',
help='force through installation')
@公共配置选项
def do_install(self,options):
“安装子模块的帮助文本”
打印(options)
@公共配置选项
def do_uninstall(self,选项):
“卸载子命令的帮助文本”
打印(选项)
app=application()
app.cmdline()
CMDLN模块提供的接口实现,但
使用argparse提供选项/arg重解析。
最初发现的代码是:argdeclare:argparse的声明性接口(http://code.activestate.com/recipes/576935 argdeclare-declare-declarative-interface-to-argparse/)
arg
def test():
仅适用于在不同函数之间重复的选项
common_options=option_group(
option('-t','--type',action='store',help='specify type of package'),
arg('package',help='package to be(un)installed'),
option('--log','-l',,action='store_true',help='log is on')
)
类应用程序(commander):
'测试应用程序的说明'
名称='app1'
版本='0.1'
默认参数=['install','--help']
@选项('--log','-l',action='store_true',help=“log is on”)
@arg('pattern',help=“pattern to delete”)
def do_delete(self,options):
“delete subcmd的帮助文本”
打印(options)
@option('-f','--force',action='store_true',
help='force through installation')
@公共配置选项
def do_install(self,options):
“安装子模块的帮助文本”
打印(options)
@公共配置选项
def do_uninstall(self,选项):
“卸载子命令的帮助文本”
打印(选项)
app=application()
app.cmdline()