udpate readme
This commit is contained in:
parent
6582088596
commit
aa20f7be39
15
README.md
15
README.md
|
@ -1,8 +1,6 @@
|
||||||
# Argument parsing for Go
|
# Argument parsing for Go
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/alexflint/go-arg"
|
|
||||||
|
|
||||||
var args struct {
|
var args struct {
|
||||||
Foo string
|
Foo string
|
||||||
Bar bool
|
Bar bool
|
||||||
|
@ -57,6 +55,17 @@ Output: [x.out y.out z.out]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage strings
|
### 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
|
```shell
|
||||||
$ ./example -h
|
$ ./example -h
|
||||||
usage: [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] [--help] INPUT [OUTPUT [OUTPUT ...]]
|
usage: [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] [--help] INPUT [OUTPUT [OUTPUT ...]]
|
||||||
|
@ -74,7 +83,7 @@ options:
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options with multiple values
|
### Options with multiple values
|
||||||
```
|
```go
|
||||||
var args struct {
|
var args struct {
|
||||||
Database string
|
Database string
|
||||||
IDs []int64
|
IDs []int64
|
||||||
|
|
Loading…
Reference in New Issue