Skip to content
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

Improve shell completion for convert-config #582

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Conversation

albers
Copy link
Contributor

@albers albers commented Dec 14, 2024

I would like to improve shell completion of kubelogin.
I started with a command and option that I use frequently: kubelogin convert-config --login.

What I did

I found it hard to spot a place where the code naturally fits.
I decided to put it beside the AddFlags methods so that I can access non-exported variables (supportedLogin)
and do not conflict with existing tests.
The structure is intended to be open for further additions.

Please let me know if this is a good way to go before I add more completions.

How to verify

Import bash completion for kubelogin:

source <(kubelogin completion bash)

Without this PR:
kubelogin convert-config <TAB><TAB> => completion of filenames (wrong)
kubelogin convert-config --login <TAB><TAB> => completion of filenames (wrong)

With this PR:
kubelogin convert-config <TAB><TAB> => no completion
kubelogin convert-config --login <TAB><TAB> => completion of supported logins

Signed-off-by: albers <github@albersweb.de>
@albers
Copy link
Contributor Author

albers commented Dec 17, 2024

@albers please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="HS - Hamburger Software GmbH & Co. KG"

@albers albers marked this pull request as ready for review December 18, 2024 08:18
Copy link
Member

@bcho bcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weinong weinong merged commit 67db75f into Azure:main Dec 19, 2024
6 checks passed
@albers albers deleted the completion branch December 20, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants