fix(campaign): name every missing required flag, in flag order

Five required flags ranged as a map, so omitting three told the operator
about one, chosen at random.
This commit is contained in:
pj committed 2026-08-18 00:17:10 +05:30
1 parent ab4c42601d
commit 2fd67d42f9
2 files changed
+46 -8

No files matched your search

+17 -8
View File
@@ -74,17 +74,26 @@ func parseArguments(arguments []string, stderr io.Writer) (config, error) {
}
configuration.extraArguments = flagSet.Args()
for name, value := range map[string]string{
"--spec": configuration.specPath,
"--bundle-id": configuration.bundleID,
"--arm": configuration.arm,
"--seeds": seedSpecification,
"--output": configuration.outputDirectory,
// Every missing flag is named together, in flag order: stopping at the
// first turns one rerun into one rerun per missing flag.
var missing []error
for _, required := range []struct {
name string
value string
}{
{"--spec", configuration.specPath},
{"--bundle-id", configuration.bundleID},
{"--arm", configuration.arm},
{"--seeds", seedSpecification},
{"--output", configuration.outputDirectory},
} {
if value == "" {
return config{}, fmt.Errorf("%s is required", name)
if required.value == "" {
missing = append(missing, fmt.Errorf("%s is required", required.name))
}
}
if err := errors.Join(missing...); err != nil {
return config{}, err
}
switch configuration.platform {
case "android", "ios", "web":
default: