# HG changeset patch # User Franz Glasner # Date 1743526167 -7200 # Node ID d47965f97abb42df593998515700eebb5f7999aa # Parent 7117f06fefb0d47b58267914844c699716fd2925 treesum: Now handle all help related stuff in main() diff -r 7117f06fefb0 -r d47965f97abb cutils/treesum.py --- a/cutils/treesum.py Tue Apr 01 16:31:20 2025 +0200 +++ b/cutils/treesum.py Tue Apr 01 18:49:27 2025 +0200 @@ -330,6 +330,9 @@ else: parser.print_help() return 0 + elif opts.subcommand == "patterns": + patparser.print_help() + return 0 # Reparse strictly opts = parser.parse_args(args=argv) @@ -342,7 +345,7 @@ ) logging.captureWarnings(True) - return treesum(opts, patparser=patparser) + return treesum(opts) FollowSymlinkConfig = collections.namedtuple("FollowSymlinkConfig", @@ -517,17 +520,19 @@ return opts -def treesum(opts, patparser=None): +def treesum(opts): # XXX TBD: opts.check and opts.checklist (as in shasum.py) if opts.subcommand in ("generate", "gen"): return generate_treesum(opts) elif opts.subcommand == "info": return print_treesum_digestfile_infos(opts) - elif opts.subcommand == "patterns": - patparser.print_help() else: + # + # NOTE: Subcommands for printing help (e.g. "patterns") should + # be handled in the caller. + # raise RuntimeError( - "command `{}' not yet handled".format(opts.subcommand)) + "command `{}' not handled".format(opts.subcommand)) def generate_treesum(opts):