initial commit

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-11-02 01:39:56 +01:00
commit aff6c82553
Se han modificado 34 ficheros con 4744 adiciones y 0 borrados

56
internal/cmd/root.go Archivo normal
Ver fichero

@@ -0,0 +1,56 @@
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()
}