diff cutils/treesum.py @ 352:b256ae4f4bc8

treesum: implement the "filetypes" command to show all the filetype indicators that are used in digest output
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 01 Apr 2025 20:38:06 +0200
parents 3fa1b95d9498
children 5fffacc390eb
line wrap: on
line diff
--- a/cutils/treesum.py	Tue Apr 01 20:15:03 2025 +0200
+++ b/cutils/treesum.py	Tue Apr 01 20:38:06 2025 +0200
@@ -268,6 +268,13 @@
                     "is listed below:",
         metavar="COMMAND")
 
+    markerparser = subparsers.add_parser(
+        "filetypes",
+        help="Show the filetype indicators for all sorts of files",
+        description=walk.HELP_FILETYPE_INDICATORS,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+        add_help=False)
+
     genparser = subparsers.add_parser(
         "generate",
         help="Generate checksums for directory trees",
@@ -334,12 +341,17 @@
                 hparser.print_help()
             elif opts.help_command == "patterns":
                 patparser.print_help()
+            elif opts.help_command == "filetypes":
+                markerparser.print_help()
             else:
                 parser.print_help()
         return 0
     elif opts.subcommand == "patterns":
         patparser.print_help()
         return 0
+    elif opts.subcommand == "filetypes":
+        markerparser.print_help()
+        return 0
 
     # Reparse strictly
     opts = parser.parse_args(args=argv)