diff --git a/distribution/server-x-dist/src/main/content/bin/kc.sh b/distribution/server-x-dist/src/main/content/bin/kc.sh index cbd5c2f402..55137594c8 100644 --- a/distribution/server-x-dist/src/main/content/bin/kc.sh +++ b/distribution/server-x-dist/src/main/content/bin/kc.sh @@ -45,7 +45,7 @@ do break ;; *) - if [[ $1 = --* || ! $1 =~ ^-.* ]]; then + if [[ $1 = --* || ! $1 =~ ^-D.* ]]; then CONFIG_ARGS="$CONFIG_ARGS $1" if [[ "$1" = "start-dev" ]]; then CONFIG_ARGS="$CONFIG_ARGS --auto-build" diff --git a/quarkus/runtime/src/main/java/org/keycloak/cli/Picocli.java b/quarkus/runtime/src/main/java/org/keycloak/cli/Picocli.java index 1d8c47d1e4..6348e997cf 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/cli/Picocli.java +++ b/quarkus/runtime/src/main/java/org/keycloak/cli/Picocli.java @@ -116,7 +116,7 @@ public final class Picocli { List suggestedArgs = cliArgs.subList(1, cliArgs.size()); - suggestedArgs.removeAll(Arrays.asList("--verbose", "--help")); + suggestedArgs.removeAll(Arrays.asList("--verbose", "-v", "--help", "-h")); cmd.getOut().printf("For an optional runtime and bypass this step, please run the '%s' command prior to starting the server:%n%n\t%s config %s%n", Build.NAME, @@ -330,7 +330,7 @@ public final class Picocli { logError(errorWriter, "ERROR: " + message); if (throwable != null) { - boolean verbose = cliArgs.stream().anyMatch("--verbose"::equals); + boolean verbose = cliArgs.contains("--verbose") || cliArgs.contains("-v"); if (throwable instanceof InitializationException) { InitializationException initializationException = (InitializationException) throwable; diff --git a/quarkus/runtime/src/main/java/org/keycloak/cli/command/AbstractStartCommand.java b/quarkus/runtime/src/main/java/org/keycloak/cli/command/AbstractStartCommand.java index 2901c7b4e6..2110a0e0ab 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/cli/command/AbstractStartCommand.java +++ b/quarkus/runtime/src/main/java/org/keycloak/cli/command/AbstractStartCommand.java @@ -25,7 +25,7 @@ public abstract class AbstractStartCommand extends AbstractCommand implements Ru public static final String AUTO_BUILD_OPTION = "--auto-build"; - @CommandLine.Option(names = AUTO_BUILD_OPTION, description = "Automatically detects whether the server configuration changed and a new server image must be built prior to starting the server. This option provides an alternative to manually running the '" + Build.NAME + "' prior to starting the server. Use this configuration carefully in production as it might impact the startup time.", required = false) + @CommandLine.Option(names = AUTO_BUILD_OPTION, description = "Automatically detects whether the server configuration changed and a new server image must be built prior to starting the server. This option provides an alternative to manually running the '" + Build.NAME + "' prior to starting the server. Use this configuration carefully in production as it might impact the startup time.", order = 1) Boolean autoConfig; @Override diff --git a/quarkus/runtime/src/main/java/org/keycloak/cli/command/Main.java b/quarkus/runtime/src/main/java/org/keycloak/cli/command/Main.java index a4f89ba1d0..67675d8191 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/cli/command/Main.java +++ b/quarkus/runtime/src/main/java/org/keycloak/cli/command/Main.java @@ -52,17 +52,22 @@ import picocli.CommandLine.Option; ) public final class Main { - @Option(names = { "--help" }, description = "This help message.", usageHelp = true) + @CommandLine.Option(names = "-D=", description = "Set a Java system property", scope = CommandLine.ScopeType.INHERIT, order = 0) + Boolean sysProps; + + @Option(names = { "-h", "--help" }, description = "This help message.", usageHelp = true) boolean help; - @Option(names = { "--version" }, description = "Show version information", versionHelp = true) + @Option(names = { "-V", "--version" }, description = "Show version information", versionHelp = true) boolean version; - @CommandLine.Option(names = "--verbose", description = "Print out more details when running this command. Useful for troubleshooting if some unexpected error occurs.", required = false, - scope = CommandLine.ScopeType.INHERIT) Boolean verbose; + @Option(names = { "-v", "--verbose" }, + description = "Print out more details when running this command. Useful for troubleshooting if some unexpected error occurs.", required = false, + scope = CommandLine.ScopeType.INHERIT) + Boolean verbose; - @Option(names = "--config-file", arity = "1", description = "Set the path to a configuration file.", paramLabel = "") + @Option(names = {"-cf", "--config-file"}, arity = "1", description = "Set the path to a configuration file.", paramLabel = "") public void setConfigFile(String path) { System.setProperty(KeycloakConfigSourceProvider.KEYCLOAK_CONFIG_FILE_PROP, path); } -} +} \ No newline at end of file