Add focused CLI argument helpers

This commit is contained in:
2026-05-31 03:31:57 +00:00
parent f2ec7bd11e
commit a973d0912d
5 changed files with 127 additions and 14 deletions

View File

@@ -13,14 +13,10 @@ func validateCommand(ctx context.Context, args []string, stdout, stderr io.Write
printValidateHelp(stdout)
return exitOK
}
if len(args) > 1 {
fmt.Fprintf(stderr, "%s: validate accepts at most one path\n", app.Name)
path, ok := parseOptionalPathArg(stderr, "validate", args)
if !ok {
return exitUsage
}
var path string
if len(args) == 1 {
path = args[0]
}
if err := app.Validate(ctx, app.ValidateOptions{Path: path, Stdout: stdout}); err != nil {
return fail(stderr, err)
}