Mercurial > hgrepos > Python > apps > py-cutils
changeset 346:d47965f97abb
treesum: Now handle all help related stuff in main()
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 01 Apr 2025 18:49:27 +0200 |
| parents | 7117f06fefb0 |
| children | 3f4840eeb0f4 |
| files | cutils/treesum.py |
| diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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):
