Is there a way in argparse
to print
my help, not auto-generated, for --help
,
but only the short help=
for single options ?
An example:
# my help, not auto-generated --
if len(sys.argv) >= 1 and sys.argv[1].startswith(( "-h", "--h" )):
print __doc__
sys.exit()
p = argparse.ArgumentParser( usage="" )
# want to print only this short help= for e.g. `-help -col`
p.add_argument( "-col", default=1, type=int,
help="the column to look at and color, 1 2 3 ..." )
# and only this help= for e.g. `-help -color`
p.add_argument( "-color", "-colour", default="red",
help="one of: r g b red green blue " )
~