-
Notifications
You must be signed in to change notification settings - Fork 924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubectl powershell completion #613
Comments
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
The following module offer tab completion of |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
I use |
@RoguePointer80 This is what you look for: https://github.com/felixfbecker/PSKubectl |
If you're looking for kubectl auto-completion in PowerShell you can have a look at PSKubectlCompletion module- https://www.powershellgallery.com/packages/PSKubectlCompletion |
/priority backlog |
It would be amazing if we can have the auto completion like on bash For eg pod names. Namespaces etc |
I really like the way the WinGet team did it. I'm sure I've also seen this pattern elsewhere. "complete" is a command on the cli tool itself, which handles the auto-completion. It can then we wrapped by any shell's auto-complete mechanism, will always be up-to-date with the application itself, and can probably re-use most of the code the cli tool already uses for determining commands. It would also make the existing shell completions for BASH/ZSH simpler and easier to maintain, as they would now simply call the CLI itself. Also means the shell completions don't need to be updated when the CLI commands change. Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
$Local:word = $wordToComplete.Replace('"', '""')
$Local:ast = $commandAst.ToString().Replace('"', '""')
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
} I presume the BASH completion function would become equally short, instead of the 13,000 lines it is now. |
There are two cool options listed in this issue, but I consider them both proofs of concept. https://github.com/felixfbecker/PSKubectl requires you to use an entirely new command syntax, which is not desirable https://www.powershellgallery.com/packages/PSKubectlCompletion is a good start, but does not support resource name completion as of yet (there's an open issue for it). |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
As information, the next release of Cobra, the library beneath kubectl, will provide support for powershell completion: |
That's dope. |
Cobra 1.1.3 has been released and provides full PowerShell completion support. Kubectl could start using it for commands and flags. However, custom completions that are defined directly in kubectl (e.g., |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
FEATURE REQUEST
It would be great to see autocompletion support for PowerShell. Is it possible for Windows releases?
The text was updated successfully, but these errors were encountered: