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

Display fzf when provided with an invalid context #334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pschmitt
Copy link

@pschmitt pschmitt commented Nov 24, 2021

When provided with an invalid (non-existant) context kubectx currently just errors out.

This PR allows providing a substring instead of the whole context name, if there's only one match, it uses that.

Example:

Given the contexts ["production", "staging", "development", "development-load"]

Before:

kubectx pro
error: no context exists with the name: "pro"

After:

kubectx pro
error: no context exists with the name: "pro"
Switched to context "production"

Before

kubectx dev
error: no context exists with the name: "dev"

After:

kubectx dev
error: no context exists with the name: "dev"
# <opens fzf with --query dev which displays "development" and "development-load">

@anton-ryzhov
Copy link

I'd love to have this feature, it's very convenient to use partial identifiers

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.

2 participants