3

I am creating a command line tool in python, and I'm using argparse to parse my input.

I want to use '-h' as an action, but that is already automatically assigned to --help. How can I override this and have an -h action?

MCharles
  • 289
  • 4
  • 11
  • Why? That's likely to be very irritating for your users. – jonrsharpe Apr 25 '15 at 18:39
  • 1
    Your question is almost a duplicate of this one: http://stackoverflow.com/questions/13075241/move-help-to-a-different-argument-group-in-python-argparse – tommy.carstensen Apr 25 '15 at 18:39
  • @jonrsharpe I needed it the other day, because I was building a wrapper around some other specialised software. I wanted to keep the flags identical between the wrapper and the software. – tommy.carstensen Apr 25 '15 at 18:42

1 Answers1

5
parser = argparse.ArgumentParser(add_help=False)

Thanks for asking, because I had the same problem the other day and only bothered checking the documentation now.

tommy.carstensen
  • 8,962
  • 15
  • 65
  • 108