fix example code
This commit is contained in:
parent
f89698667c
commit
9aad09fe14
10
README.md
10
README.md
|
@ -109,17 +109,23 @@ Fetching the following IDs from foo: [1 2 3]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom validation
|
### Custom validation
|
||||||
```
|
```go
|
||||||
var args struct {
|
var args struct {
|
||||||
Foo string
|
Foo string
|
||||||
Bar string
|
Bar string
|
||||||
}
|
}
|
||||||
p := arg.MustParse(&args)
|
p := arg.MustParse(&args)
|
||||||
if args.Foo == "" && args.Bar == "" {
|
if args.Foo == "" && args.Bar == "" {
|
||||||
p.Fail("you must provide one of --foo and --bar)
|
p.Fail("you must provide one of --foo and --bar")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./example
|
||||||
|
usage: samples [--foo FOO] [--bar BAR]
|
||||||
|
error: you must provide one of --foo and --bar
|
||||||
|
```
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
Loading…
Reference in New Issue