Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/treesum.py @ 350:3fa1b95d9498
treesum: Print also a help if no command is given
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 01 Apr 2025 19:19:07 +0200 |
| parents | 34874c45af1a |
| children | b256ae4f4bc8 |
comparison
equal
deleted
inserted
replaced
| 349:34874c45af1a | 350:3fa1b95d9498 |
|---|---|
| 309 description="Show the program's version number and exit.") | 309 description="Show the program's version number and exit.") |
| 310 | 310 |
| 311 # Parse leniently to just check for "version" and/or help | 311 # Parse leniently to just check for "version" and/or help |
| 312 opts, _dummy = parser.parse_known_args(args=argv) | 312 opts, _dummy = parser.parse_known_args(args=argv) |
| 313 | 313 |
| 314 if opts.subcommand == "version": | 314 if opts.subcommand is None: |
| 315 parser.print_help() | |
| 316 return 0 | |
| 317 elif opts.subcommand == "version": | |
| 315 print("%s (rv:%s)" % (__version__, __revision__), | 318 print("%s (rv:%s)" % (__version__, __revision__), |
| 316 file=sys.stdout) | 319 file=sys.stdout) |
| 317 return 0 | 320 return 0 |
| 318 elif opts.subcommand == "help": | 321 elif opts.subcommand == "help": |
| 319 if not opts.help_command: | 322 if not opts.help_command: |
