print full help instead of usage

This commit is contained in:
Christian Zangl 2020-09-14 16:54:54 +02:00
parent 82f848f659
commit df5fe4e07a
3 changed files with 14 additions and 10 deletions

View File

@ -41,7 +41,7 @@ chkbit will
Run `chkbit PATH` to verify only. 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 Checks files for bitrot. See https://github.com/laktak/chkbit-py
@ -49,11 +49,12 @@ positional arguments:
PATH PATH
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-u, --update update indices (without this chkbit will only verify files) -u, --update update indices (without this chkbit will only verify files)
-f, --force force update of damaged items -f, --force force update of damaged items
-q, --quiet quiet, don't show progress/information -i, --verify-index verify files in the index only (will not report new files)
-v, --verbose verbose output -q, --quiet quiet, don't show progress/information
-v, --verbose verbose output
Status codes: Status codes:
ROT: error, bitrot detected ROT: error, bitrot detected

View File

@ -51,7 +51,7 @@ class Main:
epilog=STATUS_CODES, epilog=STATUS_CODES,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
) )
parser.add_argument("PATH", nargs="+") parser.add_argument("PATH", nargs="*")
parser.add_argument( parser.add_argument(
"-u", "-u",
@ -88,6 +88,8 @@ class Main:
self.args = parser.parse_args() self.args = parser.parse_args()
self.verbose = self.args.verbose self.verbose = self.args.verbose
self.quiet = self.args.quiet self.quiet = self.args.quiet
if not self.args.PATH:
parser.print_help()
def _res_worker(self): def _res_worker(self):
while True: while True:
@ -144,8 +146,9 @@ class Main:
def main(): def main():
try: try:
m = Main() m = Main()
m.process() if m.args.PATH:
m.print_result() m.process()
m.print_result()
except KeyboardInterrupt: except KeyboardInterrupt:
print("abort") print("abort")
sys.exit(1) sys.exit(1)

View File

@ -11,7 +11,7 @@ with open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8"
setup( setup(
name="chkbit", name="chkbit",
version="2.0.2", version="2.0.3",
url="https://github.com/laktak/chkbit-py", url="https://github.com/laktak/chkbit-py",
author="Christian Zangl", author="Christian Zangl",
author_email="laktak@cdak.net", author_email="laktak@cdak.net",