package cmd import ( "fmt" "os" "github.com/spf13/cobra" "github.com/vandachevici/gconsole/cmd/servers" "github.com/vandachevici/gconsole/config" ) var rootCmd = &cobra.Command{ Use: "gconsole", Short: "gconsole — manage game servers in your homelab", Long: `gconsole is a CLI for managing game servers running on Kubernetes. It connects to the games-console backend API to list, create, edit, delete, and control (start/stop/restart) game servers. Configuration is read from ~/.gconsole/config.yaml. Override the API URL with --api-url or the GCONSOLE_API_URL env var.`, } var versionCmd = &cobra.Command{ Use: "version", Short: "Print the gconsole version", Run: func(cmd *cobra.Command, args []string) { fmt.Println("gconsole v1.0.0") }, } func Execute() { if err := rootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func init() { rootCmd.PersistentFlags().String("api-url", "", "Games console API URL (overrides config file)") rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(servers.NewServersCmd(config.GetAPIURL)) }