Further clarification
This commit is contained in:
parent
d7961941f0
commit
ba9514f0be
|
@ -122,6 +122,9 @@ Options:
|
||||||
--help, -h print this help message
|
--help, -h print this help message
|
||||||
```
|
```
|
||||||
|
|
||||||
|
As the example above shows, the `help` tag can be used in conjunction with `arg`, or instead. When used
|
||||||
|
together, they can appear in either order.
|
||||||
|
|
||||||
### Default values
|
### Default values
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
@ -322,4 +325,4 @@ The main idea behind `go-arg` is that Go already has an excellent way to describ
|
||||||
|
|
||||||
### Backward Compatibility Notes
|
### 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.
|
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. In particular, you will need to use the new `help` tag if your help text includes any commas.
|
||||||
|
|
|
@ -65,13 +65,13 @@ func TestUsageLongPositionalWithHelp_legacyForm(t *testing.T) {
|
||||||
|
|
||||||
Positional arguments:
|
Positional arguments:
|
||||||
VERYLONGPOSITIONALWITHHELP
|
VERYLONGPOSITIONALWITHHELP
|
||||||
this positional argument is very long
|
this positional argument is very long but cannot include commas
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--help, -h display this help and exit
|
--help, -h display this help and exit
|
||||||
`
|
`
|
||||||
var args struct {
|
var args struct {
|
||||||
VeryLongPositionalWithHelp string `arg:"positional,help:this positional argument is very long"`
|
VeryLongPositionalWithHelp string `arg:"positional,help:this positional argument is very long but cannot include commas"`
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := NewParser(Config{}, &args)
|
p, err := NewParser(Config{}, &args)
|
||||||
|
@ -88,13 +88,13 @@ func TestUsageLongPositionalWithHelp_newForm(t *testing.T) {
|
||||||
|
|
||||||
Positional arguments:
|
Positional arguments:
|
||||||
VERYLONGPOSITIONALWITHHELP
|
VERYLONGPOSITIONALWITHHELP
|
||||||
this positional argument is very long
|
this positional argument is very long, and includes: commas, colons etc
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--help, -h display this help and exit
|
--help, -h display this help and exit
|
||||||
`
|
`
|
||||||
var args struct {
|
var args struct {
|
||||||
VeryLongPositionalWithHelp string `arg:"positional" help:"this positional argument is very long"`
|
VeryLongPositionalWithHelp string `arg:"positional" help:"this positional argument is very long, and includes: commas, colons etc"`
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := NewParser(Config{}, &args)
|
p, err := NewParser(Config{}, &args)
|
||||||
|
|
Loading…
Reference in New Issue