Adding struct field names to examples in README
Idiomatic Go
This commit is contained in:
parent
bcfb32b8b0
commit
c99454b374
@ -137,7 +137,7 @@ Setting and querying flags is simple.
|
|||||||
``` go
|
``` go
|
||||||
...
|
...
|
||||||
app.Flags = []cli.Flag {
|
app.Flags = []cli.Flag {
|
||||||
cli.StringFlag{"lang", "english", "language for the greeting"},
|
cli.StringFlag{Name: "lang", Value: "english", Usage: "language for the greeting"},
|
||||||
}
|
}
|
||||||
app.Action = func(c *cli.Context) {
|
app.Action = func(c *cli.Context) {
|
||||||
name := "someone"
|
name := "someone"
|
||||||
@ -159,7 +159,7 @@ You can set alternate (or short) names for flags by providing a comma-delimited
|
|||||||
|
|
||||||
``` go
|
``` go
|
||||||
app.Flags = []cli.Flag {
|
app.Flags = []cli.Flag {
|
||||||
cli.StringFlag{"lang, l", "english", "language for the greeting"},
|
cli.StringFlag{Name: "lang, l", Value: "english", Usage: "language for the greeting"},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user