summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAndrew Morozko <[email protected]>2019-11-30 22:31:08 +0300
committerAndrew Morozko <[email protected]>2019-11-30 22:31:08 +0300
commit9d4521ce8be4871b3ba85cb1bfa96f4b074f505b (patch)
tree75a1540bde1cf3b46b45854e5043ca2100638888 /README.md
parentc49d847704e85799f121453cb424659a1ba43f82 (diff)
Final improvements
Diffstat (limited to 'README.md')
-rw-r--r--README.md54
1 files changed, 28 insertions, 26 deletions
diff --git a/README.md b/README.md
index ae0c567..037d8d9 100644
--- a/README.md
+++ b/README.md
@@ -148,32 +148,6 @@ var args struct {
arg.MustParse(&args)
```
-### Custom placeholders
-
-```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
-```
-
### Default values (before v1.2)
```go
@@ -361,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