summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/active_help.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/cobra/active_help.go')
-rw-r--r--vendor/github.com/spf13/cobra/active_help.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/vendor/github.com/spf13/cobra/active_help.go b/vendor/github.com/spf13/cobra/active_help.go
index 5f965e057..25c30e3cc 100644
--- a/vendor/github.com/spf13/cobra/active_help.go
+++ b/vendor/github.com/spf13/cobra/active_help.go
@@ -17,21 +17,17 @@ package cobra
import (
"fmt"
"os"
- "regexp"
- "strings"
)
const (
activeHelpMarker = "_activeHelp_ "
// The below values should not be changed: programs will be using them explicitly
// in their user documentation, and users will be using them explicitly.
- activeHelpEnvVarSuffix = "_ACTIVE_HELP"
- activeHelpGlobalEnvVar = "COBRA_ACTIVE_HELP"
+ activeHelpEnvVarSuffix = "ACTIVE_HELP"
+ activeHelpGlobalEnvVar = configEnvVarGlobalPrefix + "_" + activeHelpEnvVarSuffix
activeHelpGlobalDisable = "0"
)
-var activeHelpEnvVarPrefixSubstRegexp = regexp.MustCompile(`[^A-Z0-9_]`)
-
// AppendActiveHelp adds the specified string to the specified array to be used as ActiveHelp.
// Such strings will be processed by the completion script and will be shown as ActiveHelp
// to the user.
@@ -60,8 +56,5 @@ func GetActiveHelpConfig(cmd *Command) string {
// variable. It has the format <PROGRAM>_ACTIVE_HELP where <PROGRAM> is the name of the
// root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`.
func activeHelpEnvVar(name string) string {
- // This format should not be changed: users will be using it explicitly.
- activeHelpEnvVar := strings.ToUpper(fmt.Sprintf("%s%s", name, activeHelpEnvVarSuffix))
- activeHelpEnvVar = activeHelpEnvVarPrefixSubstRegexp.ReplaceAllString(activeHelpEnvVar, "_")
- return activeHelpEnvVar
+ return configEnvVar(name, activeHelpEnvVarSuffix)
}