foxygit / doom Log in
commit 337a663c23f7268230c8a1c2714a165040cdce40
Author:     G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 13 14:43:30 2024 -0500
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Jul 2 08:24:12 2025 +0200

    man/docgen: Add `-v` option to interpolate version

    ...similarly to existing `-s` and `-z` options.

    The `@VERSION@` replacement is not yet handled.
---
 man/docgen | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/man/docgen b/man/docgen
index 88eede03..3e8548d3 100755
--- a/man/docgen
+++ b/man/docgen
@@ -536,6 +536,7 @@ def usage():
     print("         (matches the given tag name in the source file)")
     print("   -s :  Package name, e.g. Chocolate Doom (for substitution)")
     print("   -z :  Package short-name, e.g. Chocolate (for substitution)")
+    print("   -v :  Package version e.g. 7.0 (for substitution)")
     print("   -n :  Program name, e.g. chocolate (for substitution)")
     print("   -M :  Markdown output")
     print("   -m :  Manpage output")
@@ -548,7 +549,7 @@ def usage():

 # Parse command line

-opts, args = getopt.getopt(sys.argv[1:], "n:s:z:M:m:wp:b:c:g:V")
+opts, args = getopt.getopt(sys.argv[1:], "n:s:z:v:M:m:wp:b:c:g:V")

 output_function = None
 template = None
@@ -563,6 +564,8 @@ for opt in opts:
         substs["@PACKAGE_NAME@"] = opt[1]
     if opt[0] == "-z":
         substs["@PACKAGE_SHORTNAME@"] = opt[1]
+    if opt[0] == "-v":
+        substs["@VERSION@"] = opt[1]
     if opt[0] == "-m":
         output_function = manpage_output
         template = opt[1]