Skip to content

Commit

Permalink
Fix ApplicationType completion in app registry commands
Browse files Browse the repository at this point in the history
- Simply define EnumValueProvider for ApplicationType parameters
- Fixes #5187
  • Loading branch information
jvalkeal committed Jan 18, 2023
1 parent a3168e1 commit 8e5f0fe
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.hateoas.PagedModel;
import org.springframework.shell.Availability;
import org.springframework.shell.standard.EnumValueProvider;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.ShellMethodAvailability;
Expand Down Expand Up @@ -122,7 +123,7 @@ private Availability availabilityFor(RoleType roleType, OpsType opsType) {
@ShellMethodAvailability("availableWithViewRole")
public TablesInfo info(
@ShellOption(value = { "--name" }, help = "name of the application to query", valueProvider = ApplicationNameValueProvider.class) String name,
@ShellOption(help = "type of the application to query") ApplicationType type,
@ShellOption(help = "type of the application to query", valueProvider = EnumValueProvider.class) ApplicationType type,
@ShellOption(help = "the version for the registered application", defaultValue = ShellOption.NULL) String version,
@ShellOption(help = "return all metadata, including common Spring Boot properties", defaultValue = "false") boolean exhaustive) {
TablesInfo result = new TablesInfo();
Expand Down Expand Up @@ -175,7 +176,7 @@ public TablesInfo info(
@ShellMethodAvailability("availableWithDestroyRole")
public String unregister(
@ShellOption(value = { "", "--name" }, help = "name of the application to unregister", valueProvider = ApplicationNameValueProvider.class) String name,
@ShellOption(help = "type of the application to unregister") ApplicationType type,
@ShellOption(help = "type of the application to unregister", valueProvider = EnumValueProvider.class) ApplicationType type,
@ShellOption(help = "the version application to unregister", defaultValue = ShellOption.NULL) String version) {

appRegistryOperations().unregister(name, type, version);
Expand Down Expand Up @@ -239,7 +240,7 @@ public String defaultApplication(
@ShellMethodAvailability("availableWithCreateRole")
public String register(
@ShellOption(value = { "", "--name" }, help = "the name for the registered application") String name,
@ShellOption(help = "the type for the registered application") ApplicationType type,
@ShellOption(help = "the type for the registered application", valueProvider = EnumValueProvider.class) ApplicationType type,
@ShellOption(help = "URI for the application artifact") String uri,
@ShellOption(value = { "--metadata-uri", "--metadataUri"}, help = "Metadata URI for the application artifact", defaultValue = ShellOption.NULL) String metadataUri,
@ShellOption(help = "force update if application is already registered (only if not in use)", defaultValue = "false") boolean force) {
Expand Down

0 comments on commit 8e5f0fe

Please sign in to comment.