From 260a0a866f557bfc012dc2e2a08a6e047ac1f73b Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Wed, 14 Sep 2022 00:41:59 -0500 Subject: [PATCH] Added help/version text --- .gitignore | 8 ++++++++ hist/__main__.py | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3be4b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +**/__pycache__ +**/__mypycache__ +**/*.pyc +build + +# `make build` deletes these but the files can persist if it hits an error +*.egg-info + diff --git a/hist/__main__.py b/hist/__main__.py index 1fdcc12..caff62b 100644 --- a/hist/__main__.py +++ b/hist/__main__.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +VERSION=(1,0,0,) + import sys import fileinput @@ -10,8 +12,15 @@ def main(): _config, _positionals = cli.main(sys.argv[1:]) if "version" in _config.keys(): + sys.stderr.write(f"hist {'.'.join(str(v) for v in VERSION)}\n") sys.exit(0) elif "help" in _config.keys(): + sys.stderr.write(f"Usage: hist [OPTIONS]\n") + sys.stderr.write(f"Options:\n") + sys.stderr.write(f" -b=BINS, --bins=BINS number of bins in histogram [Default: 10]\n") + sys.stderr.write(f" -h, -x, --help print this message and exit\n") + sys.stderr.write(f" -p, --positive force scale to be positive\n") + sys.stderr.write(f" -v, -V, --version print version and exit\n") sys.exit(0) _bins = int(_config.get("bins", 10)) -- 2.45.2