Add config loading and dry-run validation

This commit is contained in:
2026-05-31 01:53:13 +00:00
parent 22d0424232
commit 29dbad2967
16 changed files with 928 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package cli
import (
"context"
"flag"
"fmt"
"io"
@@ -13,11 +14,24 @@ func runCommand(ctx context.Context, args []string, stdout, stderr io.Writer) in
printRunHelp(stdout)
return exitOK
}
if len(args) > 0 {
fmt.Fprintf(stderr, "%s: run does not accept options yet: %v\n", app.Name, args)
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 err := app.Run(ctx, app.RunOptions{}); err != nil {
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
@@ -25,8 +39,13 @@ func runCommand(ctx context.Context, args []string, stdout, stderr io.Writer) in
func printRunHelp(w io.Writer) {
fmt.Fprint(w, `Usage:
distributor run
distributor run --config <path> --dry-run
The run command is present but distribution behavior is not implemented yet.
Options:
--config <path> 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.
`)
}