iterm-components icon indicating copy to clipboard operation
iterm-components copied to clipboard

Switch kubectl contexts via component

Open daneah opened this issue 5 years ago • 2 comments

It would be awesome if the kubectl context component, when clicked, would show a popover menu of the available contexts via:

kubectl config view -o jsonpath='{.contexts[*].name}' | tr " " "\n"

And switch to one of the displayed contexts when clicked via:

kubectl config use-context <context>

The popover is covered well in the docs (see onclick in this example) but being able to click items inside the popover isn't AFAICT.

The built in git state component does something like this, but the built-ins all appear to be written in Objective-C.

daneah avatar Apr 07 '19 13:04 daneah

I don't think this can be done just yet. The python API does not offer any way of creating menu items, selecting them, etc.

The python API will most likely evolve and add the ability to handle menus, but considering the current state, doing the context selection does not seem feasible :)

Nice work by the way!

gragera avatar Aug 12 '19 07:08 gragera

Thanks for the input @gragera. I wondered if this might be possible using the popover and some further response to a click action inside the popover, but I didn't get far enough on it to say one way or the other.

daneah avatar Aug 12 '19 14:08 daneah