# HG changeset patch # User Franz Glasner # Date 1735916738 -3600 # Node ID b39f8082ced1e7c539fba1712d092674c661e551 # Parent 492975912cadc7a2a7f823233ad807258b2dc442 Make a "version" subcommand to also print the program's version number for "treesum" diff -r 492975912cad -r b39f8082ced1 cutils/treesum.py --- a/cutils/treesum.py Fri Jan 03 16:05:11 2025 +0100 +++ b/cutils/treesum.py Fri Jan 03 16:05:38 2025 +0100 @@ -117,8 +117,20 @@ "This is an alias to \"generate\".") _populate_generate_arguments(genparser2) + vparser = subparsers.add_parser( + "version", + help="Show the program's version number and exit", + description="Show the program's version number and exit.") + vparser.add_argument( + "args", nargs=argparse.REMAINDER, help="IGNORED.") + opts = parser.parse_args(args=argv) + if opts.subcommand == "version": + print("%s (rv:%s)" % (__version__, __revision__), + file=sys.stdout) + sys.exit(0) + if not opts.algorithm: opts.algorithm = util.argv2algo("blake2b-256")