From 7dafee9146338acfbecfb65bc994d0cf6a9c5fdf Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Thu, 18 Nov 2021 08:37:08 +0000 Subject: [PATCH] Add __main__ CLI hook to support local dev This follows the convention for typer prorams. Note the same can also be achieved with e.g. python -c 'from pms.cli import main; main()' but having it run automatically saves documenting this. --- src/pms/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pms/cli.py b/src/pms/cli.py index 7428deb..d857644 100644 --- a/src/pms/cli.py +++ b/src/pms/cli.py @@ -131,3 +131,7 @@ def csv( csv.write("time,sensor,hex\n") for raw in reader(raw=True): csv.write(f"{raw.time},{sensor_name},{raw.hex}\n") + + +if __name__ == "__main__": # pragma: no cover + main()