summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2019-12-01 01:22:05 -0800
committerGitHub <[email protected]>2019-12-01 01:22:05 -0800
commitced05bfe8a0f966d6ed09af656f5410bc5f4ed7c (patch)
tree75a1540bde1cf3b46b45854e5043ca2100638888 /README.md
parentc0c7a3ba8a1854cd85e65cca4f0e2028698a0738 (diff)
parent9d4521ce8be4871b3ba85cb1bfa96f4b074f505b (diff)
Merge pull request #96 from Andrew-Morozko/master
Added the "placeholder" tag
Diffstat (limited to 'README.md')
-rw-r--r--README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1f02559..037d8d9 100644
--- a/README.md
+++ b/README.md
@@ -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