Skip to content

Instantly share code, notes, and snippets.

@jfischer
Created February 28, 2017 21:12
Show Gist options
  • Save jfischer/19656fa5176121eb4e5a70ad07b2aadb to your computer and use it in GitHub Desktop.
Save jfischer/19656fa5176121eb4e5a70ad07b2aadb to your computer and use it in GitHub Desktop.
Boilerplate for Python 3 command line scripts
#!/usr/bin/env python3
"""
DESCRIBE SCRIPT HERE
"""
import sys
import argparse
def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(description='WHAT THIS PROGRAM DOES.')
# Example arg. See https://docs.python.org/3/library/argparse.html#adding-arguments
parser.add_argument('--oscillation-overthrusters', default=False,
action='store_true',
help="Enable oscillation overthrusters")
args = parser.parse_args(args=argv)
# Use the args here
return 0 # ok status
if __name__=='__main__':
sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment