Re:Challenge: Implement CLI interface like that?
by halst on Monday June 18, 2012 @03:06PM
(#4127963)
About long options repeated: you can either specify "[options]" shortcut in a pattern in order not to put all options in that pattern, or you can have all options listed in the pattern--then you can avoid having them in option description.
About repeating program's name (say "naval_fate"), you can do:
"""Usage: prog <bla> ...
prog <bla> --bla
"""
args = docopt(__doc__.replace('prog', 'naval_fate'))
One nitpick is that there is still some repetition: "naval_fate", and well as the long options are repeated. Granted, there might be ways around that which I haven't discovered yet.