diff --git a/java/google/registry/tools/SetNumInstancesCommand.java b/java/google/registry/tools/SetNumInstancesCommand.java index 3f0b64d66..76c64fa43 100644 --- a/java/google/registry/tools/SetNumInstancesCommand.java +++ b/java/google/registry/tools/SetNumInstancesCommand.java @@ -35,6 +35,7 @@ import google.registry.tools.AppEngineConnection.Service; import google.registry.util.AppEngineServiceUtils; import java.io.IOException; import java.util.List; +import java.util.Locale; import java.util.Set; import javax.inject.Inject; @@ -57,21 +58,21 @@ final class SetNumInstancesCommand implements CommandWithRemoteApi { // TODO(b/119629679): Use List after upgrading jcommander to latest version. @Parameter( - names = "--services", + names = {"-s", "--services"}, description = "Comma-delimited list of App Engine services to set. " + "Allowed values: [DEFAULT, TOOLS, BACKEND, PUBAPI]") private List serviceNames = ImmutableList.of(); @Parameter( - names = "--versions", + names = {"-v", "--versions"}, description = "Comma-delimited list of App Engine versions to set, e.g., canary. " + "Cannot be set if --non_live_versions is set.") private List versions = ImmutableList.of(); @Parameter( - names = "--num_instances", + names = {"-n", "--num_instances"}, description = "The new number of instances for the given versions " + "or for all non-live versions if --non_live_versions is set.", @@ -92,10 +93,11 @@ final class SetNumInstancesCommand implements CommandWithRemoteApi { String projectId; @Override - public void run() throws Exception { + public void run() { ImmutableSet services = serviceNames.stream() + .map(s -> s.toUpperCase(Locale.US)) .map( name -> checkArgumentPresent( diff --git a/javatests/google/registry/tools/SetNumInstancesCommandTest.java b/javatests/google/registry/tools/SetNumInstancesCommandTest.java index 856f93793..c60fdc034 100644 --- a/javatests/google/registry/tools/SetNumInstancesCommandTest.java +++ b/javatests/google/registry/tools/SetNumInstancesCommandTest.java @@ -99,7 +99,7 @@ public class SetNumInstancesCommandTest extends CommandTestCase runCommand("--services=DEFAULT", "--versions=version")); assertThat(thrown) .hasMessageThat() - .contains("The following option is required: --num_instances"); + .contains("The following option is required: -n, --num_instances"); } @Test @@ -156,6 +156,19 @@ public class SetNumInstancesCommandTest extends CommandTestCase