diff options
| author | Alex Flint <[email protected]> | 2015-10-31 18:51:21 -0700 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2015-10-31 18:51:21 -0700 |
| commit | aa20f7be3968590f4b4c88c42745b6a379eef746 (patch) | |
| tree | cad3853472c9c972019e7267ce58aa3ebd3443e1 | |
| parent | 65820885963ded66c34560ac619b323a8bbfc032 (diff) | |
udpate readme
| -rw-r--r-- | README.md | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,11 +1,9 @@ # Argument parsing for Go ```go -import "github.com/alexflint/go-arg" - var args struct { - Foo string - Bar bool + Foo string + Bar bool } arg.MustParse(&args) fmt.Println(args.Foo, args.Bar) @@ -57,6 +55,17 @@ Output: [x.out y.out z.out] ``` ### Usage strings +```go +var args struct { + Input string `arg:"positional"` + Output []string `arg:"positional"` + Verbose bool `arg:"-v,help:verbosity level"` + Dataset string `arg:"help:dataset to use"` + Optimize int `arg:"-O,help:optimization level"` +} +arg.MustParse(&args) +``` + ```shell $ ./example -h usage: [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] [--help] INPUT [OUTPUT [OUTPUT ...]] @@ -74,7 +83,7 @@ options: ``` ### Options with multiple values -``` +```go var args struct { Database string IDs []int64 |
