From f98b2e614c6e954e16b86fd3e3f2a1f5a6f3a61e Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Sat, 1 May 2021 15:12:21 +0100 Subject: [PATCH] cope with no args --- kiln-tuner.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kiln-tuner.py b/kiln-tuner.py index b7a3674..1fdda65 100755 --- a/kiln-tuner.py +++ b/kiln-tuner.py @@ -174,6 +174,7 @@ def calculate(filename, tangentdivisor, showplot): if __name__ == "__main__": parser = argparse.ArgumentParser(description='Kiln tuner') subparsers = parser.add_subparsers() + parser.set_defaults(mode='') parser_profile = subparsers.add_parser('recordprofile', help='Record kiln temperature profile') parser_profile.add_argument('csvfile', type=str, help="The CSV file to write to.") @@ -197,5 +198,9 @@ if __name__ == "__main__": calculate(args.csvfile, args.tangentdivisor, args.showplot) + elif args.mode == '': + parser.print_help() + exit(1) + else: raise NotImplementedError(f"Unknown mode {args.mode}")