github.com/esnet/gdg@v0.6.1-0.20240412190737-6b6eba9c14d8/cmd/gdg-generate/cli/config.go (about) 1 package cli 2 3 import ( 4 "fmt" 5 "github.com/esnet/gdg/internal/config" 6 "github.com/spf13/cobra" 7 "gopkg.in/yaml.v3" 8 "log" 9 "log/slog" 10 ) 11 12 var showConfigCmd = &cobra.Command{ 13 Use: "config", 14 Short: "Show current templates configuration", 15 Long: `Show current templates configuration`, 16 Aliases: []string{"cfg"}, 17 Run: func(cmd *cobra.Command, args []string) { 18 data, err := yaml.Marshal(config.Config().GetTemplateConfig()) 19 if err != nil { 20 log.Fatalf("unable to load template configuration: %v", err) 21 } 22 slog.Info("Configuration", 23 slog.String("template-config", tplCfgFile), 24 slog.String("gdg-config", cfgFile)) 25 fmt.Println(string(data)) 26 }, 27 } 28 29 func init() { 30 rootCmd.AddCommand(showConfigCmd) 31 }