package cmd import ( "kontor-api-gin/internal/config" "log/slog" "github.com/spf13/cobra" "github.com/spf13/viper" ) var configCmd = &cobra.Command{ Use: "config", TraverseChildren: true, Short: "show current config", Long: "show current config", // Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { slog.Info("show config") var config config.CliConfig if err := viper.Unmarshal(&config); err != nil { slog.Info("unable to decode config", "error", err.Error()) } for name, server := range config.Server { slog.Info("show config", "server", name, "URL", server.Url) } slog.Info("show config", "config", config) }, } func init() { rootCmd.AddCommand(configCmd) }