-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add secret and namespace completion (requires kubectl 1.26) #35
base: master
Are you sure you want to change the base?
Conversation
For this to work, you will need kubectl 1.26 and a shim that you can create with the following command: cat <<'EOF' >~/bin/kubectl_complete-view_secret && chmod u+x ~/bin/kubectl_complete-view_secret kubectl view-secret __complete "$@" EOF See: kubernetes/kubernetes#105867
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution @maelvls, do you mind adding some tests as well?
@@ -191,3 +193,167 @@ func ProcessSecret(outWriter, errWriter io.Writer, secret map[string]interface{} | |||
|
|||
return nil | |||
} | |||
|
|||
func getNamespaces(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like toComplete
is unused
return nil, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
|
||
func getSecrets(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args
is unsed, can we ignore _
it?
I built your version and tested, but it doesn't seem to pick up the script or work. I am using 1.27.X |
I took a slightly different approach in #47 allowing you to interactively select the secret (not the namespace yet). I might add proper completion support at some point after I receive some feedback on the current ergonomics |
Hi, the addition to interactively select the secret is really great. However, one of our namespaces has more than 3000 secrets. Scrolling through them in a list isn't working. Tab completion would really be welcome in this case. Hopefully it will still be added! |
For this to work, you will need kubectl 1.26 and a shim that you can create with the following command:
See: kubernetes/kubernetes#105867
Closes #3