Hacker News new | ask | show | jobs
by m463 975 days ago
I use argparse too, and it's one of the best python libraries (and my most-used)

you can do short (one character) or long arguments with argparse directly:

  parser = argparse.ArgumentParser(argument_default=None)
  parser.add_argument('-d', '--debug', action='store_true', help='debug flag')
I also do lots of other things, like long help with no args like this:

  if len(sys.argv) == 1:
      parser.print_help(sys.stderr)
      sys.exit(1)