daneah / iterm-components

:computer: Custom status bar components for use with iTerm2

Home Page:https://www.iterm2.com/3.3/documentation-status-bar.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch kubectl contexts via component

daneah opened this issue · 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.

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!

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.