diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-20 23:13:56 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-20 23:13:56 -0400 |
| commit | c10f596bb0451df399ca67a37279227a22539bf6 (patch) | |
| tree | 496d9fc27f992dfb8e6700162701183f824a8fc7 /docs | |
| parent | c60b94a34289d6dc7e66f003c70d844a0f98acb4 (diff) | |
Document help and manpages
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/command-line-parsing.md | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/command-line-parsing.md b/docs/command-line-parsing.md index 283c41d0..714e6e9c 100644 --- a/docs/command-line-parsing.md +++ b/docs/command-line-parsing.md @@ -182,3 +182,44 @@ func main(output|o:Path? = none, verbose|v:Bool = no) ```bash $ tomo -e program.tm && ./program -vo outfile.txt` ``` + +## Help and Manpages + +When your program is generated, it will also come with a `--help` flag (unless +you have one defined) with automatically generated usage information. If you +add comments in front of your main function arguments, they will appear in the +`--help` output. Additionally, when your program is compiled, Tomo will also +build a Manpage for your program in `.build/yourprogram.1`, which will get +installed if you install your program. + +```tomo +func main( + # Whether or not to frob your gropnoggles + frob: Bool = no +) + pass +``` + +```bash +$ tomo -e myprogram.tm +$ ./myprogram --help +# Usage: ./myprogram [--help] [--frob|--no-frob] +# +# --frob|--no-frob Whether or not to frob your gropnoggles (default:no) +# +``` + +```bash +$ man .build/myprogram.1 +``` + +``` +MYPROGRAM(1) + +NAME + myprogram - a Tomo program + +OPTIONS + --frob | --no-frob + Whether or not to frob your gropnoggles +``` |
