From 27ee2b9dfebd2adac5f64dbcbb3a7a56b413a684 Mon Sep 17 00:00:00 2001 From: Sylvain Rabot Date: Sun, 17 May 2026 20:23:39 +0200 Subject: [PATCH] feat(cli): add a --context flag alias of --kube-context For parity with kubectl. Signed-off-by: Sylvain Rabot --- pkg/cli/environment.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cli/environment.go b/pkg/cli/environment.go index 45d773eb4..0fefd9d5d 100644 --- a/pkg/cli/environment.go +++ b/pkg/cli/environment.go @@ -152,6 +152,7 @@ func New() *EnvSettings { func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVarP(&s.namespace, "namespace", "n", s.namespace, "namespace scope for this request") fs.StringVar(&s.KubeConfig, "kubeconfig", "", "path to the kubeconfig file") + fs.StringVar(&s.KubeContext, "context", "", "name of the kubeconfig context to use (alias for --kube-context)") fs.StringVar(&s.KubeContext, "kube-context", s.KubeContext, "name of the kubeconfig context to use") fs.StringVar(&s.KubeToken, "kube-token", s.KubeToken, "bearer token used for authentication") fs.StringVar(&s.KubeAsUser, "kube-as-user", s.KubeAsUser, "username to impersonate for the operation") @@ -169,6 +170,8 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.Float32Var(&s.QPS, "qps", s.QPS, "queries per second used when communicating with the Kubernetes API, not including bursting") fs.StringVar(&s.ColorMode, "color", s.ColorMode, "use colored output (never, auto, always)") fs.StringVar(&s.ColorMode, "colour", s.ColorMode, "use colored output (never, auto, always)") + + fs.MarkHidden("context") } func envOr(name, def string) string {