diff options
| author | Alex Flint <[email protected]> | 2015-11-01 13:53:51 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2015-11-01 13:53:51 -0800 |
| commit | 60f2612c0c59b979f71241405515e722bf6943f0 (patch) | |
| tree | 3d1c3a8a8414e9213c70ce44590dc317f51249ac /README.md | |
| parent | bcb41ba0489082c8b3b2bff9aece9047c3c375aa (diff) | |
separate help into WriteUsage and WriteHelp
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 38 |
1 files changed, 22 insertions, 16 deletions
@@ -19,17 +19,6 @@ $ ./example --foo=hello --bar hello true ``` -### Default values - -```go -var args struct { - Foo string - Bar bool -} -args.Foo = "default value" -arg.MustParse(&args) -``` - ### Required arguments ```go @@ -40,6 +29,12 @@ var args struct { arg.MustParse(&args) ``` +```shell +$ ./example +usage: example --foo FOO [--bar] +error: --foo is required +``` + ### Positional arguments ```go @@ -79,11 +74,22 @@ positional arguments: output options: ---verbose, -v verbosity level ---dataset DATASET dataset to use ---optimize OPTIMIZE, -O OPTIMIZE - optimization level ---help, -h print this help message + --verbose, -v verbosity level + --dataset DATASET dataset to use + --optimize OPTIMIZE, -O OPTIMIZE + optimization level + --help, -h print this help message +``` + +### Default values + +```go +var args struct { + Foo string + Bar bool +} +args.Foo = "default value" +arg.MustParse(&args) ``` ### Arguments with multiple values |
