diff options
| author | Andrew Morozko <[email protected]> | 2019-11-30 00:22:21 +0300 |
|---|---|---|
| committer | Andrew Morozko <[email protected]> | 2019-11-30 00:22:21 +0300 |
| commit | c3a019cdb8116ae3b4a928c2a14efd83df7f34aa (patch) | |
| tree | 04b6fdab240fb204221af4a500ca170eaf3972fd /README.md | |
| parent | 904e03926794663089b73d52a02def065d819200 (diff) | |
Various changes
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -148,6 +148,32 @@ 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 |
