python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Feature request short arguments in help text

Open ConorSheehan1 opened this issue 4 years ago • 0 comments

Saw short arguments were added in #141, which looks great!

I was wondering if it'd be possible to include the short args in help text too?

I was thinking something like, given:

# foo.py
import fire

def func(foo=False, bar='bar', baz='dupe'):
    pass

if __name__ == '__main__':
    fire.Fire(func)

The output could change like this:

# python foo.py --help
 FLAGS
-    --foo=FOO
+    -f, --foo=FOO
         Default: False
     --bar=BAR
         Default: 'bar'
     --baz=BAZ
         Default: 'dupe'

I'd be happy to try and pr this myself if you think it's worth adding?

ConorSheehan1 avatar Feb 04 '21 22:02 ConorSheehan1