diff options
| author | Alex Flint <[email protected]> | 2019-12-01 01:22:05 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-12-01 01:22:05 -0800 |
| commit | ced05bfe8a0f966d6ed09af656f5410bc5f4ed7c (patch) | |
| tree | 75a1540bde1cf3b46b45854e5043ca2100638888 /README.md | |
| parent | c0c7a3ba8a1854cd85e65cca4f0e2028698a0738 (diff) | |
| parent | 9d4521ce8be4871b3ba85cb1bfa96f4b074f505b (diff) | |
Merge pull request #96 from Andrew-Morozko/master
Added the "placeholder" tag
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -335,6 +335,34 @@ $ ./example main.NameDotName{Head:"file", Tail:"txt"} ``` +### Custom placeholders + +Use the `placeholder` tag to control which placeholder text is used in the usage text. + +```go +var args struct { + Input string `arg:"positional" placeholder:"SRC"` + Output []string `arg:"positional" placeholder:"DST"` + Optimize int `arg:"-O" help:"optimization level" placeholder:"LEVEL"` + MaxJobs int `arg:"-j" help:"maximum number of simultaneous jobs" placeholder:"N"` +} +arg.MustParse(&args) +``` +```shell +$ ./example -h +Usage: example [--optimize LEVEL] [--maxjobs N] SRC [DST [DST ...]] + +Positional arguments: + SRC + DST + +Options: + --optimize LEVEL, -O LEVEL + optimization level + --maxjobs N, -j N maximum number of simultaneous jobs + --help, -h display this help and exit +``` + ### Description strings ```go |
