package cmd import ( "fmt" "os" "github.com/spf13/cobra" "github.com/yourusername/buque/internal/config" ) var ( cfgFile string configMgr *config.Manager rootCmd *cobra.Command ) func init() { cobra.OnInitialize(initConfig) rootCmd = &cobra.Command{ Use: "buque", Short: "Buque - Docker Compose environment manager", Long: `Buque is a command-line tool for managing multiple Docker Compose environments on a single machine. It provides easy deployment, monitoring, and maintenance of containerized applications with nginx-proxy integration.`, Version: "1.0.0", } rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.buque/config.yaml)") // Add all subcommands rootCmd.AddCommand(initCmd) rootCmd.AddCommand(envCmd) rootCmd.AddCommand(upCmd) rootCmd.AddCommand(downCmd) rootCmd.AddCommand(restartCmd) rootCmd.AddCommand(updateCmd) rootCmd.AddCommand(statsCmd) rootCmd.AddCommand(logsCmd) rootCmd.AddCommand(psCmd) rootCmd.AddCommand(proxyCmd) rootCmd.AddCommand(pullCmd) rootCmd.AddCommand(pruneCmd) } func initConfig() { configMgr = config.NewManager(cfgFile) if _, err := configMgr.Load(); err != nil { fmt.Fprintf(os.Stderr, "Warning: failed to load config: %v\n", err) } } // Execute runs the root command func Execute() error { return rootCmd.Execute() }