plugins: add user-defined shortcuts from config.yaml - #42
Open
beagleknight wants to merge 2 commits into
Open
Conversation
A `plugins:` list in ~/.config/ku/config.yaml binds a key on the table to an external command. The command receives the selected row as $NAMESPACE, $NAME, $RESOURCE, $CONTEXT, $CLUSTER and $KUBECONFIG, both expanded in `args` and exported to its environment. It runs detached with a result notice (`background: true`) or inside the embedded terminal. `confirm: true` asks first. Scopes accept any resource string the picker resolves, plus `all`. Plugins appear in the footer, the command palette and the help screen for the resources they are scoped to. Keys the table already uses are refused with a startup notice, and the first plugin wins a duplicate key. Plugins work in read-only mode: the user authored them. The editor and plugin sessions share a new startPTY helper. The client exposes ClusterName for $CLUSTER.
Contributor
|
Wow, great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a plugin system. A
plugins:list in~/.config/ku/config.yamlbinds a key on the table to an external command, in the spirit of k9s plugins.key,desc,scopes,command,args,background,confirm.$NAMESPACE,$NAME,$RESOURCE,$CONTEXT,$CLUSTERand$KUBECONFIGare expanded inargsand exported to the command's environment.background: trueruns the command detached and shows the result as a notice. Without it, the command runs in the embedded terminal.confirm: trueasks before the run.all.Behaviour
Code
internal/ui/plugins.goandplugins_test.go.startEditand plugins share a newstartPTYhelper.k8s.ClientexposesClusterNamefor$CLUSTER.docs/configuration.md,docs/keybindings.md,docs/features.md,README.md.Test
make testandmake vetpass. 18 new tests.Motivation
I run GitHub Actions runners on Kubernetes (ARC). A plugin resolves a runner pod to its workflow job page and opens it in the browser. The same mechanism covers any "open this row in an external tool" need without adding code to ku.