Created
October 2, 2019 22:57
-
-
Save neksa/8eb381acee9e5f8983a4b846374c163c to your computer and use it in GitHub Desktop.
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
import argparse | |
class Test(): | |
def __init__(self): | |
"""INITIALIZE PARSER""" | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--name', type=str, required=False, default='World') | |
parser.add_argument( | |
'--testFlag', | |
help='Will it run?', | |
action='store_true', | |
default=False, | |
required=False) | |
args = parser.parse_args() | |
[getattr(self, key)(args) for key, val in vars(args).items() if isinstance(val, bool) and val] | |
def testFlag(self, args): | |
print("Hello {}!".format(args.name)) | |
if __name__ == '__main__': | |
Test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment