aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/urfave/cli/flag.go
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2018-02-11 21:43:56 -0800
committerGitHub <noreply@github.com>2018-02-11 21:43:56 -0800
commit8b6cbfcca9d1f3fb5b05a91b4ac0bca66f75f19e (patch)
tree5f6fdc40c7518bc23a63fdac9a92b516dd0c6d36 /vendor/github.com/urfave/cli/flag.go
parentaebae1aae2fc61185a8bbc96313d8462727ad202 (diff)
parentb330463662825a7d7b22efabb2b7a40640d2b18e (diff)
Merge pull request #85 from google/depfix
Complete the new Build System
Diffstat (limited to 'vendor/github.com/urfave/cli/flag.go')
-rw-r--r--vendor/github.com/urfave/cli/flag.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/vendor/github.com/urfave/cli/flag.go b/vendor/github.com/urfave/cli/flag.go
index b17f5b9..877ff35 100644
--- a/vendor/github.com/urfave/cli/flag.go
+++ b/vendor/github.com/urfave/cli/flag.go
@@ -37,14 +37,6 @@ var HelpFlag Flag = BoolFlag{
// to display a flag.
var FlagStringer FlagStringFunc = stringifyFlag
-// FlagNamePrefixer converts a full flag name and its placeholder into the help
-// message flag prefix. This is used by the default FlagStringer.
-var FlagNamePrefixer FlagNamePrefixFunc = prefixedNames
-
-// FlagEnvHinter annotates flag help message with the environment variable
-// details. This is used by the default FlagStringer.
-var FlagEnvHinter FlagEnvHintFunc = withEnvHint
-
// FlagsByName is a slice of Flag.
type FlagsByName []Flag
@@ -718,13 +710,13 @@ func stringifyFlag(f Flag) string {
switch f.(type) {
case IntSliceFlag:
- return FlagEnvHinter(fv.FieldByName("EnvVar").String(),
+ return withEnvHint(fv.FieldByName("EnvVar").String(),
stringifyIntSliceFlag(f.(IntSliceFlag)))
case Int64SliceFlag:
- return FlagEnvHinter(fv.FieldByName("EnvVar").String(),
+ return withEnvHint(fv.FieldByName("EnvVar").String(),
stringifyInt64SliceFlag(f.(Int64SliceFlag)))
case StringSliceFlag:
- return FlagEnvHinter(fv.FieldByName("EnvVar").String(),
+ return withEnvHint(fv.FieldByName("EnvVar").String(),
stringifyStringSliceFlag(f.(StringSliceFlag)))
}
@@ -752,8 +744,8 @@ func stringifyFlag(f Flag) string {
usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultValueString))
- return FlagEnvHinter(fv.FieldByName("EnvVar").String(),
- fmt.Sprintf("%s\t%s", FlagNamePrefixer(fv.FieldByName("Name").String(), placeholder), usageWithDefault))
+ return withEnvHint(fv.FieldByName("EnvVar").String(),
+ fmt.Sprintf("%s\t%s", prefixedNames(fv.FieldByName("Name").String(), placeholder), usageWithDefault))
}
func stringifyIntSliceFlag(f IntSliceFlag) string {
@@ -803,5 +795,5 @@ func stringifySliceFlag(usage, name string, defaultVals []string) string {
}
usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultVal))
- return fmt.Sprintf("%s\t%s", FlagNamePrefixer(name, placeholder), usageWithDefault)
+ return fmt.Sprintf("%s\t%s", prefixedNames(name, placeholder), usageWithDefault)
}