feat: go output formatter

This commit is contained in:
2025-07-20 15:19:47 +02:00
parent 0b0f0c9f0a
commit ef07dd1b86
6 changed files with 50 additions and 11 deletions

View File

@ -31,12 +31,13 @@ func initRootCmd() {
var appConfig AppConfig
rootCmd.PersistentFlags().BoolVarP(&appConfig.OutputVerbose, "verbose", "v", false, "Enable verbose output")
rootCmd.PersistentFlags().StringVarP(&appConfig.OutputMode, "output", "o", "json", "Set output format")
rootCmd.PersistentFlags().StringVarP(&appConfig.OutputFormatter, "output", "o", "json", "Set output format")
rootCmd.PersistentFlags().BoolVar(&appConfig.PrintConfig, "print-config", false, "Enable printing the application config")
logger := jlog.New(slog.LevelDebug)
ctx := jlog.ContextWith(context.Background(), logger)
logger.Debug("Register verb commands")
rootCmd.AddCommand(getVerbs(ctx, appConfig)...)
rootCmd.AddCommand(getVerbs(ctx, &appConfig)...)
logger.Debug("Verb commands registered successfully")
}