Created
June 20, 2012 17:50
-
-
Save chadgh/2961165 to your computer and use it in GitHub Desktop.
simple python module that provides a few useful setups for other command line python scripts. Requires plumbum
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/python | |
| import sys | |
| import argparse | |
| from plumbum import local, FG, BG | |
| local = local | |
| FG = FG | |
| BG = BG | |
| def getArgParser(program=__file__, desc=''): | |
| """Generates a default argparser for command line python scripts.""" | |
| parser = argparse.ArgumentParser(prog=program, description=desc) | |
| parser.add_argument('-v', '--verbose', action='store_true', default=False, help="display actual commands executed") | |
| parser.add_argument('-t', '--test', action='store_true', default=False, help="display actual commands executed, but don't execute") | |
| return parser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment