diff options
| author | Rick <[email protected]> | 2017-10-02 14:18:41 +0100 |
|---|---|---|
| committer | Rick <[email protected]> | 2017-10-02 14:18:41 +0100 |
| commit | d7961941f0ceee4e55062041991de7bbd43b2b57 (patch) | |
| tree | 8eb798350d16f89ebfceca8b22011427c69b2289 /README.md | |
| parent | 398a01ebab8b6260be8714a39ad19ecb0db58dc1 (diff) | |
Altered help tag parsing to reduce the constraints on help text content; old behaviour is retained for backward compatibility
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -99,9 +99,9 @@ Workers: 4 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"` + Verbose bool `arg:"-v" help:"verbosity level"` + Dataset string `help:"dataset to use"` + Optimize int `arg:"-O" help:"optimization level"` } arg.MustParse(&args) ``` @@ -306,7 +306,7 @@ Options: --help, -h display this help and exit ``` -### Documentation +### API Documentation https://godoc.org/github.com/alexflint/go-arg @@ -319,3 +319,7 @@ The shortcomings of the `flag` library that ships in the standard library are we Many third-party argument parsing libraries are geared for writing sophisticated command line interfaces. The excellent `codegangsta/cli` is perfect for working with multiple sub-commands and nested flags, but is probably overkill for a simple script with a handful of flags. The main idea behind `go-arg` is that Go already has an excellent way to describe data structures using Go structs, so there is no need to develop more levels of abstraction on top of this. Instead of one API to specify which arguments your program accepts, and then another API to get the values of those arguments, why not replace both with a single struct? + +### Backward Compatibility Notes + +The tags have changed recently. Earlier versions required the help text to be part of the `arg` tag. This is still supported but is now deprecated. Instead, you should use a separate `help` tag, described above, which removes most of the limits on the text you can write. |
