[KEYCLOAK-19309] - Minor fixes and improvements

This commit is contained in:
Pedro Igor 2021-10-13 16:27:17 -03:00
parent 5d560c1051
commit fa1544a25e
4 changed files with 15 additions and 10 deletions

View file

@ -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"

View file

@ -116,7 +116,7 @@ public final class Picocli {
List<String> 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;

View file

@ -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

View file

@ -52,16 +52,21 @@ import picocli.CommandLine.Option;
)
public final class Main {
@Option(names = { "--help" }, description = "This help message.", usageHelp = true)
@CommandLine.Option(names = "-D<key>=<value>", 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 = "<path>")
@Option(names = {"-cf", "--config-file"}, arity = "1", description = "Set the path to a configuration file.", paramLabel = "<path>")
public void setConfigFile(String path) {
System.setProperty(KeycloakConfigSourceProvider.KEYCLOAK_CONFIG_FILE_PROP, path);
}