aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/urfave/cli/flag.go
diff options
context:
space:
mode:
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)
}