Python Language Native way (no libraries)


Example

"""
usage: sub <command>

commands:

  status -  show status
  list   -  print list
"""

import sys

def check():
    print("status")
    return 0

if sys.argv[1:] == ['status']:
    sys.exit(check())
elif sys.argv[1:] == ['list']:
    print("list")
else:
    print(__doc__.strip())

Output without arguments:

usage: sub <command>

commands:

  status -  show status
  list   -  print list

Pros:

  • no deps
  • everybody should be able to read that
  • complete control over help formatting