python - Why does my use of click.argument produce "got an unexpected keyword argument 'help'? -


running following code results in error: typeerror: __init__() got unexpected keyword argument 'help'

import click  @click.command() @click.argument('command', required=1, help="start|stop|restart") @click.option('--debug/--no-debug', default=false, help="run in foreground") def main(command, debug):     print (command)     print (debug)  if __name__ == '__main__':         main() 

full error output:

$ python3 foo.py start traceback (most recent call last):   file "foo.py", line 5, in <module>     @click.option('--debug/--no-debug', default=false, help="run in foreground")   file "/home/cbetti/python/lib/python3/dist-packages/click-4.0-py3.4.egg/click/decorators.py", line 148, in decorator     _param_memo(f, argumentclass(param_decls, **attrs))   file "/home/cbetti/python/lib/python3/dist-packages/click-4.0-py3.4.egg/click/core.py", line 1618, in __init__     parameter.__init__(self, param_decls, required=required, **attrs) typeerror: __init__() got unexpected keyword argument 'help' 

why?

you defining commands arguments. note click has better way define commands trying here.

@click.group() def main():     pass  @click.command() def start():     print "running command `start`"  @click.command() def stop():     print "running command `stop`"  main.add_command(start) main.add_command(stop)  if __name__ == '__main__':     main() 

will result in following default text:

usage: test.py [options] command [args]...  options:   --help  show message , exit.  commands:   start   stop 

having said that, should need arguments, cannot use help parameter. click documentation indeed states should document own arguments. however, have no idea how that. hints?


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -