Created
April 19, 2023 13:55
-
-
Save SamDudley/47f9332b3a42039535dc915cd5a77ea4 to your computer and use it in GitHub Desktop.
A Python CLI script template using argparse to handle arguments.
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
#!/usr/bin/env python3 | |
import argparse | |
def main(args): | |
print(args.foo) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("foo") | |
args = parser.parse_args() | |
main(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment