~dricottone/hist

260a0a866f557bfc012dc2e2a08a6e047ac1f73b — Dominic Ricottone 2 years ago 5e992c2
Added help/version text
2 files changed, 17 insertions(+), 0 deletions(-)

A .gitignore
M hist/__main__.py
A .gitignore => .gitignore +8 -0
@@ 0,0 1,8 @@
**/__pycache__
**/__mypycache__
**/*.pyc
build

# `make build` deletes these but the files can persist if it hits an error
*.egg-info


M hist/__main__.py => hist/__main__.py +9 -0
@@ 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))