Skip to content

Commit 72a6466

Browse files
committed
docs: describe empty values for any source, not only environment variables
Move the paragraph from the environment section to the general note on Sources order, since an empty file is skipped the same way.
1 parent c40d7b3 commit 72a6466

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎docs/v3/examples/flags/value-sources.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ func main() {
6262
If `cli.EnvVars` contains more than one string, the first environment variable that
6363
resolves is used.
6464

65-
An environment variable that is set but empty only counts as a value for string and
66-
bool flags, where it means an empty string and `false`. For other flags it is skipped,
67-
so it does not satisfy `Required`, does not make `IsSet` true, and does not hide a
68-
later variable in the list.
69-
7065
<!-- {
7166
"args": ["&#45;&#45;help"],
7267
"output": "language for the greeting.*LEGACY_COMPAT_LANG.*APP_LANG.*LANG"
@@ -141,6 +136,11 @@ func main() {
141136
Note that default values are set in the same order as they are defined in the
142137
`Sources` param. This allows the user to choose order of priority
143138

139+
An empty value from any source, such as an environment variable that is set but empty
140+
or an empty file, only counts as a value for string and bool flags, where it means an
141+
empty string and `false`. For any other flag it is skipped, so it does not satisfy
142+
`Required`, does not make `IsSet` true, and does not hide a later source.
143+
144144
#### Values from alternate input sources (YAML, TOML, and others)
145145

146146
There is a separate package [altsrc](https://github.com/urfave/cli-altsrc) that adds support for getting flag values

0 commit comments

Comments
 (0)