Created
September 18, 2024 17:51
-
-
Save sapristi/0871c831fd9b744de41cff4c9c63d5ae 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
import argparse | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--name", help="Any name", default="inconnu") | |
parser.add_argument("action", help="Action to execute") | |
args = parser.parse_args() | |
if args.action == "hello": | |
print(f"Hello {args.name}") | |
elif args.action == "goodbye": | |
print(f"Goodby {args.name}") | |
else: | |
print(f"Unrecognized action {args.action}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment