diff --git a/completions.go b/completions.go index 5070becc0..5788674ff 100644 --- a/completions.go +++ b/completions.go @@ -212,7 +212,7 @@ func (c *Command) initCompleteCmd(args []string) { // 2- Even without completions, we need to print the directive } - noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd || GetEnvConfig(cmd, configEnvVarSuffixDescriptions) == configEnvVarDescriptionsOff + noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd || getEnvConfig(cmd, configEnvVarSuffixDescriptions) == configEnvVarDescriptionsOff noActiveHelp := GetActiveHelpConfig(finalCmd) == activeHelpGlobalDisable out := finalCmd.OutOrStdout() for _, comp := range completions { @@ -920,12 +920,12 @@ func configEnvVar(name, suffix string) string { return v } -// GetEnvConfig returns the value of the configuration environment variable +// getEnvConfig returns the value of the configuration environment variable // _ where is the name of the root command in upper // case, with all non-ASCII-alphanumeric characters replaced by `_`. // If the value is empty or not set, the value of the environment variable // COBRA_ is returned instead. -func GetEnvConfig(cmd *Command, suffix string) string { +func getEnvConfig(cmd *Command, suffix string) string { v := os.Getenv(configEnvVar(cmd.Root().Name(), suffix)) if v == "" { v = os.Getenv(configEnvVar(configEnvVarGlobalPrefix, suffix)) diff --git a/completions_test.go b/completions_test.go index 213c17a83..c8af7e8f6 100644 --- a/completions_test.go +++ b/completions_test.go @@ -3586,7 +3586,7 @@ func TestGetEnvConfig(t *testing.T) { defer assertNoErr(t, os.Unsetenv(tc.globalVar)) assertNoErr(t, err) cmd := &Command{Use: tc.use} - got := GetEnvConfig(cmd, tc.suffix) + got := getEnvConfig(cmd, tc.suffix) if got != tc.expected { t.Errorf("expected: %q, got: %q", tc.expected, got) }