diff --git a/README.md b/README.md index 8f9bd6bd..a32e2acd 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,9 @@ K9s allows you to extend your command line and tooling by defining your very own K9s does provide additional environment variables for you to customize your plugins arguments. Currently, the available environment variables are as follows: +* `$RESOURCE_GROUP` -- the selected resource group +* `$RESOURCE_VERSION` -- the selected resource api version +* `$RESOURCE_NAME` -- the selected resource name * `$NAMESPACE` -- the selected resource namespace * `$NAME` -- the selected resource name * `$CONTAINER` -- the current container if applicable diff --git a/internal/view/table.go b/internal/view/table.go index 422c2884..bb178625 100644 --- a/internal/view/table.go +++ b/internal/view/table.go @@ -107,6 +107,10 @@ func (t *Table) defaultEnv() Env { env["NAMESPACE"], env["FILTER"] = client.Namespaced(path) } + env["RESOURCE_GROUP"] = t.GVR().G() + env["RESOURCE_VERSION"] = t.GVR().V() + env["RESOURCE_NAME"] = t.GVR().R() + return env }