-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
add bash-completion for comma separated list on kubectl get
#98301
add bash-completion for comma separated list on kubectl get
#98301
Conversation
Hi @phil9909. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig cli |
/assign |
/ok-to-test |
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.
In general looks good the patch also tested. I have few comments.
./_output/local/go/bin/kubectl completion bash > ~/.kube/completion.bash.inc
./_output/local/go/bin/kubectl get pods,sec<TAB>
/triage accepted |
@phil9909 could you please squash the patches? |
`kubectl get` supports specifying a comma separated list of resource types. E.g.: ```bash kubectl get pods,secrets ``` Will list all pods and secrets in the current namespace. This commit adds support to the kubectl bash completion for this feature. Which means if you type `kubectl get pods,sec<tab>` it will be auto-completed to `kubectl get pods,secrets` (assuming the cluster does not have a CRD starting with `sec`).
0af4784
to
51671ec
Compare
Done. While I was on it, I also rebased onto master. |
/test pull-kubernetes-node-e2e |
Looks sane to me. We need one more people to review/approve. |
@brianpursley would you mind having a look? |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: phil9909, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kubernetes-e2e-kind |
This is a nice change! Note that it does not seem to work for But I have included this feature in the conversion from bash to Go code of #96087 which allows us to no longer worry about such differences. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
kubectl get
supports specifying a comma separated list of resource types. E.g.:Will list all pods and secrets in the current namespace.
This commit adds support to the kubectl bash completion for this feature.
Which means if you type
kubectl get pods,sec
+ tab it will be auto-completed tokubectl get pods,secrets
(assuming the cluster does not have a CRD starting withsec
).Which issue(s) this PR fixes:
None
Special notes for your reviewer:
After running
make kubectl
you need to runsource <(./_output/bin/kubectl completion bash)
then you can try the new completion.In theory other
kubectl
commands support comma separated lists of resources. One can dokubectl edit secret,configmap test
which will open an editor with both resources (or fail if one or both don't exist).As I think the use-cases for other commands are limited, I don't think we need completion for this.
Should this be proven wrong one can simply change the
case
block.Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: