mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
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:
1 parent
ab4c42601d
commit
2fd67d42f9
2 files changed
+46
-8
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user