Skip to content

Instantly share code, notes, and snippets.

@mattgathu
Created July 22, 2015 06:09
Show Gist options
  • Save mattgathu/6e7b9d8d29ad98942268 to your computer and use it in GitHub Desktop.
Save mattgathu/6e7b9d8d29ad98942268 to your computer and use it in GitHub Desktop.
Python Command Line Arguments Parser
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