feat: add completion for output flag

This commit is contained in:
2025-07-24 23:37:42 +02:00
parent 5205ddf094
commit cdd3216f46

View File

@ -45,6 +45,9 @@ func initRootCmd() {
rootCmd.PersistentFlags().BoolVar(&appConfig.OutputOrderReverse, "reverse", false, "Reverses output item order") rootCmd.PersistentFlags().BoolVar(&appConfig.OutputOrderReverse, "reverse", false, "Reverses output item order")
rootCmd.PersistentFlags().BoolVar(&appConfig.PrintConfig, "print-config", false, "Enable printing the application config") rootCmd.PersistentFlags().BoolVar(&appConfig.PrintConfig, "print-config", false, "Enable printing the application config")
// Add flag completions
rootCmd.RegisterFlagCompletionFunc("output", cobra.FixedCompletions(formatters, cobra.ShellCompDirectiveNoFileComp))
// Create logger and add child commands // Create logger and add child commands
logger := jlog.New(slog.LevelDebug) logger := jlog.New(slog.LevelDebug)
ctx := jlog.ContextWith(context.Background(), logger) ctx := jlog.ContextWith(context.Background(), logger)