Created
July 22, 2015 06:09
-
-
Save mattgathu/6e7b9d8d29ad98942268 to your computer and use it in GitHub Desktop.
Python Command Line Arguments Parser
This file contains 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
DESCRIPTION = """logfind is a simple commandline tool that allows log files | |
scanning without having to explicitly declare every file on the command line.""" | |
EPILOG = 'Created by insert-your-name' | |
def cli_parser(): | |
"""Command Line Arguments parser | |
""" | |
parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) | |
parser.add_argument('term', nargs='+', metavar='SEARCH_TERM', help='search term(s)') | |
parser.add_argument('-o', action='store_true', | |
help='use OR logic in finding search terms') | |
args = vars(parser.parse_args()) | |
return args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment