def _globals(command):
def proxy(verbose, alwaysprompt, neverprompt, **kwargs):
# handle these global options
setverbose(verbose)
if alwaysprompt:
if neverprompt:
raise UsageError("--alwaysprompt and --neverprompt options"
" cannot be used together")
setwantprompt(PROMPT_ALWAYS)
elif neverprompt:
setwantprompt(PROMPT_NEVER)
# pass all other arguments on to the command
command(**kwargs)
proxy.__name__ = command.__name__
proxy.__doc__ = command.__doc__
proxy = option('-a', '--alwaysprompt', is_flag=True,
help="Always prompt the user to answer questions, even"
" named questions that they have answered on previous runs"
)(proxy)
proxy = option('-n', '--neverprompt', is_flag=True,
help="Never prompt the user to answer questions. Questions"
" will be answered automatically using the user's previous"
" answer or the `noprompt` value.")(proxy)
proxy = option('-v', '--verbose', 'verbose', is_flag=True,
help="Produce extra output")(proxy)
return proxy
评论列表
文章目录