Last active
October 30, 2018 22:30
-
-
Save ConstantinoSchillebeeckx/9d6339550d2767e279a8df5cb4a3197d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
TODOC | |
Usage: | |
------ | |
./boiler_plate.py -d required -p optional | |
''' | |
__author__ = "Constantino Schillebeeckx" | |
__version__ = "0.1.0" | |
__license__ = "N/A" | |
import argparse | |
def main(args): | |
# MAIN | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser( | |
usage=__doc__, | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter | |
) | |
required = parser.add_argument_group('required arguments') | |
# Specify output of "--version" | |
parser.add_argument( | |
"--version", | |
action="version", | |
version="%(prog)s (version {version})".format(version=__version__)) | |
required.add_argument( | |
"-d", | |
"--dir", | |
action="store", | |
required=True, | |
help=( | |
"Required argument gets its own section." | |
) | |
) | |
parser.add_argument( | |
"-p", | |
"--problem", | |
action="store", | |
default='problem', | |
help="Optional argument" | |
) | |
args = parser.parse_args() | |
main(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment