Skip to content

Commit

Permalink
feat: Set up basic CLI structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mircea-pavel-anton committed Aug 11, 2024
1 parent 4411ba5 commit 4735301
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -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")
}
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"github.com/mirceanton/kube-switcher/cmd"
)

func main() {
cmd.Execute()
}

0 comments on commit 4735301

Please sign in to comment.