From 197ffd83265e830eb7d5b789ed964283d46e8745 Mon Sep 17 00:00:00 2001 From: Mircea-Pavel ANTON Date: Sun, 11 Aug 2024 12:38:00 +0000 Subject: [PATCH] fix: add version flag to cobra cmd --- cmd/root.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 5b4eb51..ca53f99 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -7,11 +7,13 @@ import ( ) var configDir string // Global flag for the kubeconfig directory +var version string // The version of the tool, set at build time var rootCmd = &cobra.Command{ - Use: "kube-switcher", - Short: "A tool to switch Kubernetes contexts", - Long: `kube-switcher is a CLI tool to switch Kubernetes contexts from multiple kubeconfig files.`, + Use: "kube-switcher", + Short: "A tool to switch Kubernetes contexts", + Long: `kube-switcher is a CLI tool to switch Kubernetes contexts from multiple kubeconfig files.`, + Version: version, } func Execute() {