pull/10656/merge
Marc Khouzam 7 months ago committed by GitHub
commit e1c32217f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -170,7 +170,9 @@ func manuallyProcessArgs(args []string) ([]string, []string) {
return v
}
}
return ""
// Return something different than what we received by adding a random prefix.
// We cannot simply return an empty string as v could be an empty string itself.
return fmt.Sprintf("x%s", v)
}
for i := 0; i < len(args); i++ {

@ -116,6 +116,8 @@ func TestLoadPlugins(t *testing.T) {
{"env", "env stuff", "show the env", "env\n", []string{}, 0},
{"exitwith", "exitwith code", "This exits with the specified exit code", "", []string{"2"}, 2},
{"fullenv", "show env vars", "show all env vars", envs + "\n", []string{}, 0},
// Test that empty arguments are passed to the plugin
{"numargs", "echo num args", "echo number of arguments received", "3\n", []string{"-a", "", "-b"}, 0},
}
plugins := cmd.Commands()
@ -271,6 +273,7 @@ func TestLoadPluginsForCompletion(t *testing.T) {
{"more", []string{"one", "two"}, []string{"b", "ball"}, []staticCompletionDetails{}},
}},
}},
{"numargs", []string{}, []string{}, []staticCompletionDetails{}},
}
checkCommand(t, cmd.Commands(), tests)
}

@ -0,0 +1,4 @@
name: numargs
usage: "echo num args"
description: "echo number of arguments received"
command: "$HELM_PLUGIN_DIR/numargs.sh"

@ -3,5 +3,6 @@ echo echo stuff
env env stuff
exitwith exitwith code
fullenv show env vars
numargs echo num args
:4
Completion ended with directive: ShellCompDirectiveNoFileComp

@ -2,5 +2,6 @@ echo echo stuff
env env stuff
exitwith exitwith code
fullenv show env vars
numargs echo num args
:4
Completion ended with directive: ShellCompDirectiveNoFileComp

Loading…
Cancel
Save