kubectx icon indicating copy to clipboard operation
kubectx copied to clipboard

Display fzf when provided with an invalid context

Open pschmitt opened this issue 3 years ago • 1 comments

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">

pschmitt avatar Nov 24 '21 09:11 pschmitt

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

anton-ryzhov avatar Jan 04 '22 08:01 anton-ryzhov