package cli import ( "context" "flag" "fmt" "io" "gitea.maximumdirect.net/eric/distributor/internal/app" ) func runCommand(ctx context.Context, args []string, stdout, stderr io.Writer) int { if hasHelp(args) { printRunHelp(stdout) return exitOK } flags := flag.NewFlagSet("run", flag.ContinueOnError) flags.SetOutput(stderr) configPath := flags.String("config", "", "path to config file") dryRun := flags.Bool("dry-run", false, "load and validate config without publishing") if err := flags.Parse(args); err != nil { return exitUsage } if flags.NArg() > 0 { fmt.Fprintf(stderr, "%s: run does not accept positional arguments: %v\n", app.Name, flags.Args()) return exitUsage } if err := app.Run(ctx, app.RunOptions{ ConfigPath: *configPath, DryRun: *dryRun, Stdout: stdout, }); err != nil { return fail(stderr, err) } return exitOK } func printRunHelp(w io.Writer) { fmt.Fprint(w, `Usage: distributor run --config --dry-run Options: --config Path to config file --dry-run Load and validate config without publishing Execution behavior is not implemented yet. Dry-run currently prints a resolved configuration summary only. `) }