diff options
author | Håkon Solbjørg <hlsolbjorg@gmail.com> | 2019-04-01 22:43:27 +0200 |
---|---|---|
committer | Håkon Solbjørg <hlsolbjorg@gmail.com> | 2019-04-02 19:56:08 +0200 |
commit | 98e35a3fa02b598d104cde9aafb877006d8065b3 (patch) | |
tree | dcee95cb0847b81a33051683eacb7a5e572bdddd /main.py | |
parent | 8b2ce44bbe1456088f72d677a48cb230cf0991e1 (diff) |
feat: Add argparse to allow for specifying which labler function to run 🤙
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,5 +1,20 @@ +import argparse +import sys + from switches import make_switch_labels +from cables import make_cable_labels +parser = argparse.ArgumentParser("Label generator script 2000") +parser.add_argument("labler", type=str, + help="The label function to run. Either [c]ables or [s]witches.") if __name__ == "__main__": - make_switch_labels() + args = parser.parse_args() + + if args.labler[0] == "c": + make_cable_labels() + elif args.labler[0] == "s": + make_switch_labels() + else: + parser.print_help() + sys.exit("Invalid labler operation.") |