- from getopt import getopt, GetoptError
-
- try:
- options, arguments = getopt(sys.argv[1:], "ho", ["help", "old"])
- except GetoptError:
- usage(1)
-
- old = False
-
- for option, value in options:
- if option in ("-h", "--help"):
- usage()
- elif option in ("-o", "--old"):
- old = True
- else:
- usage(2)