You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
k9s includes shell autocompletion commands that appear to have been taken directly from kubectl except they don't work as expected.
I work with a number of contexts and switching between them, especially with OIDC, is quite slow. I prefer to start k9s with a --context flag to select my desired context upon startup but the lack of completion suggestions is frustrating.
The undocumented __complete autocomplete suggestions command only works to suggest the top level functions but does not work for suggesting options to double-dash parameters like --context.
To Reproduce
% k9s __complete ""
completion Generate the autocompletion script for the specified shell
help Help about any command
info List K9s configurations info
version Print version/build info
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
% k9s __complete - ""
:0
Completion ended with directive: ShellCompDirectiveDefault
% k9s __complete --context ""
:0
Completion ended with directive: ShellCompDirectiveDefault
Furthermore the command suggests that --completion, --help, --info, --version should also work but they end in a panic except for --help. [EDIT: - this is an incorrect statement but k9s should handle incorrect flags without panicking]
% k9s __complete -- ""
completion Generate the autocompletion script for the specified shell
help Help about any command
info List K9s configurations info
version Print version/build info
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
% k9s --version
Error: unknown flag: --version
[-snipped-]
panic: unknown flag: --version
goroutine 1 [running]:
github.com/derailed/k9s/cmd.Execute(...)
github.com/derailed/k9s/cmd/root.go:60
main.main()
github.com/derailed/k9s/main.go:32 +0x3c
Expected behavior
k9s should be able to suggest completion options for flags the same way kubectl does, eg.
% kubectl __complete --user ""
local
oidc
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
% k9s __complete --user ""
:0
Completion ended with directive: ShellCompDirectiveDefault
Additional context
It took me quite a while to work out that the output from k9s completion zsh actually calls k9s __complete <flags> "string" to get its suggestions.
The text was updated successfully, but these errors were encountered:
Describe the bug
k9s includes shell autocompletion commands that appear to have been taken directly from kubectl except they don't work as expected.
I work with a number of contexts and switching between them, especially with OIDC, is quite slow. I prefer to start k9s with a
--context
flag to select my desired context upon startup but the lack of completion suggestions is frustrating.The undocumented
__complete
autocomplete suggestions command only works to suggest the top level functions but does not work for suggesting options to double-dash parameters like--context
.To Reproduce
Furthermore the command suggests that[EDIT: - this is an incorrect statement but k9s should handle incorrect flags without panicking]--completion
,--help
,--info
,--version
should also work but they end in a panic except for--help
.Expected behavior
k9s should be able to suggest completion options for flags the same way kubectl does, eg.
and
Versions:
Seems to affect all versions
Additional context
It took me quite a while to work out that the output from
k9s completion zsh
actually callsk9s __complete <flags> "string"
to get its suggestions.The text was updated successfully, but these errors were encountered: