diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..5b4eb51 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + +var configDir string // Global flag for the kubeconfig directory + +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.`, +} + +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + // Add any global flags here + rootCmd.PersistentFlags().StringVarP(&configDir, "kubeconfig-dir", "", "", "Directory containing kubeconfig files") +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..f51dc1c --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "github.com/mirceanton/kube-switcher/cmd" +) + +func main() { + cmd.Execute() +}