aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-23 15:57:44 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-11-23 15:57:44 -0500
commit83a2bff4bb04b0189d17419baf8ca520992d5033 (patch)
tree63c24b6419e0896d985cb0c9f30b742274e95833 /docs
parent2a24b0a3fc3c4986572ae2c4ea0e8e387497a7f6 (diff)
Added Metadata section for files instead of _HELP and _USAGE
Diffstat (limited to 'docs')
-rw-r--r--docs/command-line-parsing.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/command-line-parsing.md b/docs/command-line-parsing.md
index 714e6e9c..92e9a1c9 100644
--- a/docs/command-line-parsing.md
+++ b/docs/command-line-parsing.md
@@ -223,3 +223,36 @@ OPTIONS
--frob | --no-frob
Whether or not to frob your gropnoggles
```
+
+## Metadata
+
+You can specify metadata for a program, which is used for CLI messages like
+`--help`, as well as manpage documentation. Metadata can be specified as either
+a text literal (no interpolation) or as a file path literal.
+
+```
+USAGE: "--foo <n>"
+HELP: "
+ This is some custom help text.
+ You can use these flags:
+
+ --foo <n> The foo parameter
+ --help Show this message
+"
+MANPAGE_DESCRIPTION: (./description.roff)
+```
+
+Supported metadata:
+
+- `USAGE`: the short form usage shown in CLI parsing errors and help pages. This
+ should be a single line without the name of the program, so `USAGE: "--foo"`
+ would translate to the error message `Usage: myprogram --foo`. If this is not
+ present, it will be generated automatically.
+
+- `HELP`: The help message displayed when the `--help` flag is used or when there
+ is an argument parsing error. This should be a description of the program with
+ a multi-line documentation of commonly used flags.
+
+- `MANPAGE_SYNOPSYS`: the synopsis section of the manpage (inserted literally).
+
+- `MANPAGE_DESCRIPTION`: the description section of the manpage (inserted literally).