document field in README
This commit is contained in:
parent
c698b821b8
commit
4cc453ba67
33
README.md
33
README.md
@ -32,6 +32,7 @@ applications in an expressive way.
|
|||||||
+ [Alternate Names](#alternate-names)
|
+ [Alternate Names](#alternate-names)
|
||||||
+ [Ordering](#ordering)
|
+ [Ordering](#ordering)
|
||||||
+ [Values from the Environment](#values-from-the-environment)
|
+ [Values from the Environment](#values-from-the-environment)
|
||||||
|
+ [Values from files](#values-from-files)
|
||||||
+ [Values from alternate input sources (YAML, TOML, and others)](#values-from-alternate-input-sources-yaml-toml-and-others)
|
+ [Values from alternate input sources (YAML, TOML, and others)](#values-from-alternate-input-sources-yaml-toml-and-others)
|
||||||
+ [Precedence](#precedence)
|
+ [Precedence](#precedence)
|
||||||
* [Subcommands](#subcommands)
|
* [Subcommands](#subcommands)
|
||||||
@ -587,6 +588,38 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Values from Files
|
||||||
|
|
||||||
|
You can also have the default value set from file via `FilePath`. e.g.
|
||||||
|
|
||||||
|
<!-- {
|
||||||
|
"args": ["--help"],
|
||||||
|
"output": "language for the greeting.*APP_LANG"
|
||||||
|
} -->
|
||||||
|
``` go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := cli.NewApp()
|
||||||
|
|
||||||
|
app.Flags = []cli.Flag {
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "password, p",
|
||||||
|
Usage: "password for the mysql database",
|
||||||
|
FilePath: "/etc/mysql/password",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Run(os.Args)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Values from alternate input sources (YAML, TOML, and others)
|
#### Values from alternate input sources (YAML, TOML, and others)
|
||||||
|
|
||||||
There is a separate package altsrc that adds support for getting flag values
|
There is a separate package altsrc that adds support for getting flag values
|
||||||
|
Loading…
Reference in New Issue
Block a user