From df5fe4e07adfd7fbbbfa45e2ebbcd133b8ff4bb7 Mon Sep 17 00:00:00 2001 From: Christian Zangl Date: Mon, 14 Sep 2020 16:54:54 +0200 Subject: [PATCH] print full help instead of usage --- README.md | 13 +++++++------ chkbit/main.py | 9 ++++++--- setup.py | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 26e769e..a293309 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ chkbit will Run `chkbit PATH` to verify only. ``` -usage: chkbit.py [-h] [-u] [-f] [-q] [-v] PATH [PATH ...] +usage: chkbit.py [-h] [-u] [-f] [-i] [-q] [-v] [PATH [PATH ...]] Checks files for bitrot. See https://github.com/laktak/chkbit-py @@ -49,11 +49,12 @@ positional arguments: PATH optional arguments: - -h, --help show this help message and exit - -u, --update update indices (without this chkbit will only verify files) - -f, --force force update of damaged items - -q, --quiet quiet, don't show progress/information - -v, --verbose verbose output + -h, --help show this help message and exit + -u, --update update indices (without this chkbit will only verify files) + -f, --force force update of damaged items + -i, --verify-index verify files in the index only (will not report new files) + -q, --quiet quiet, don't show progress/information + -v, --verbose verbose output Status codes: ROT: error, bitrot detected diff --git a/chkbit/main.py b/chkbit/main.py index 0e5a23e..aefbda4 100644 --- a/chkbit/main.py +++ b/chkbit/main.py @@ -51,7 +51,7 @@ class Main: epilog=STATUS_CODES, formatter_class=argparse.RawDescriptionHelpFormatter, ) - parser.add_argument("PATH", nargs="+") + parser.add_argument("PATH", nargs="*") parser.add_argument( "-u", @@ -88,6 +88,8 @@ class Main: self.args = parser.parse_args() self.verbose = self.args.verbose self.quiet = self.args.quiet + if not self.args.PATH: + parser.print_help() def _res_worker(self): while True: @@ -144,8 +146,9 @@ class Main: def main(): try: m = Main() - m.process() - m.print_result() + if m.args.PATH: + m.process() + m.print_result() except KeyboardInterrupt: print("abort") sys.exit(1) diff --git a/setup.py b/setup.py index dda53d6..ee39bee 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8" setup( name="chkbit", - version="2.0.2", + version="2.0.3", url="https://github.com/laktak/chkbit-py", author="Christian Zangl", author_email="laktak@cdak.net",