diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Help.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Help.java index 40b199a78e4..bf5a960729c 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Help.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Help.java @@ -157,45 +157,32 @@ public final class Help extends CommandLine.Help { } private boolean isVisible(OptionSpec option) { - if (option.description().length == 0) { - // do not show options without a description + if (option.description().length == 0 || option.hidden()) { + // do not show options without a description nor hidden return false; } + + if (allOptions) { + return true; + } String optionName = undecorateDuplicitOptionName(option.longestName()); OptionCategory category = null; - if (option.group() != null) { + if (option.group() != null && option.group().heading() != null) { category = OptionCategory.fromHeading(removeSuffix(option.group().heading(), ":")); } PropertyMapper mapper = getMapper(optionName, category); if (mapper == null) { final var disabledMapper = PropertyMappers.getDisabledMapper(optionName); - final var isDisabledMapper = disabledMapper.isPresent(); - + // Show disabled mappers, which do not have a description when they're enabled - final var isEnabledWhenEmpty = isDisabledMapper && disabledMapper.get().getEnabledWhen().isEmpty(); - if (isEnabledWhenEmpty) { - return true; - } - - if (allOptions && isDisabledMapper) { - return true; - } - - // only filter mapped options, defaults to the hidden marker - return !option.hidden() && !isDisabledMapper; + return disabledMapper.flatMap(PropertyMapper::getEnabledWhen).isEmpty(); } - boolean isUnsupportedOption = !PropertyMappers.isSupported(mapper); - - if (isUnsupportedOption) { - // unsupported options removed from help if all options are not requested - return !option.hidden() && allOptions; - } - - return !option.hidden(); + // unsupported options removed from help if all options are not requested + return PropertyMappers.isSupported(mapper); } public void setAllOptions(boolean allOptions) { diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt index 3090fad2ccf..8798eae4625 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt @@ -171,16 +171,10 @@ Logging: DEPRECATED. Set the format for the GELF timestamp field. Uses Java SimpleDateFormat pattern. Default: yyyy-MM-dd HH:mm:ss,SSS. Available only when GELF is activated. ---log-gelf-version - The GELF version to be used. Possible values are: 1.0, 1.1. Default: 1.1. - Available only when GELF is activated. --log-level The log level of the root category or a comma-separated list of individual categories and their levels. For the root category, you don't need to specify a category. Default: info. ---log-syslog-app-name - The app name used when formatting the message in RFC5424 format. Default: - keycloak. Available only when Syslog is activated. --log-syslog-endpoint The IP address and port of the syslog server. Default: localhost:514. Available only when Syslog is activated. @@ -217,4 +211,4 @@ Export: --users-per-file Set the number of users per file. It is used only if 'users' is set to 'different_files'. Increasing this number leads to exponentially increasing - export times. Default: 50. + export times. Default: 50. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt index 1486b7a9879..10b9f14eaf1 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt @@ -171,16 +171,10 @@ Logging: DEPRECATED. Set the format for the GELF timestamp field. Uses Java SimpleDateFormat pattern. Default: yyyy-MM-dd HH:mm:ss,SSS. Available only when GELF is activated. ---log-gelf-version - The GELF version to be used. Possible values are: 1.0, 1.1. Default: 1.1. - Available only when GELF is activated. --log-level The log level of the root category or a comma-separated list of individual categories and their levels. For the root category, you don't need to specify a category. Default: info. ---log-syslog-app-name - The app name used when formatting the message in RFC5424 format. Default: - keycloak. Available only when Syslog is activated. --log-syslog-endpoint The IP address and port of the syslog server. Default: localhost:514. Available only when Syslog is activated. @@ -211,4 +205,4 @@ Import: --file Set the path to a file that will be read. --override Set if existing data should be overwritten. If set to false, data will be - ignored. Default: true. + ignored. Default: true. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt index 9cee99fa773..a5229b5677c 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt @@ -191,10 +191,6 @@ Hostname v1 (Deprecated): headers to allow internal and external applications. If all applications use the public URL this option should be enabled. Default: false. Available only when hostname:v1 feature is enabled. ---hostname-strict-https - DEPRECATED. Forces frontend URLs to use the 'https' scheme. If set to false, - the HTTP scheme is inferred from requests. Default: true. Available only - when hostname:v1 feature is enabled. --hostname-url DEPRECATED. Set the base URL for frontend URLs, including scheme, host, port and path. Available only when hostname:v1 feature is enabled. @@ -384,16 +380,10 @@ Logging: DEPRECATED. Set the format for the GELF timestamp field. Uses Java SimpleDateFormat pattern. Default: yyyy-MM-dd HH:mm:ss,SSS. Available only when GELF is activated. ---log-gelf-version - The GELF version to be used. Possible values are: 1.0, 1.1. Default: 1.1. - Available only when GELF is activated. --log-level The log level of the root category or a comma-separated list of individual categories and their levels. For the root category, you don't need to specify a category. Default: info. ---log-syslog-app-name - The app name used when formatting the message in RFC5424 format. Default: - keycloak. Available only when Syslog is activated. --log-syslog-endpoint The IP address and port of the syslog server. Default: localhost:514. Available only when Syslog is activated. @@ -430,4 +420,4 @@ Security: Do NOT start the server using this command when deploying to production. Use 'kc.sh start-dev --help-all' to list all available options, including build -options. +options. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt index 71f903f1d2a..c50deebb8f3 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt @@ -192,10 +192,6 @@ Hostname v1 (Deprecated): headers to allow internal and external applications. If all applications use the public URL this option should be enabled. Default: false. Available only when hostname:v1 feature is enabled. ---hostname-strict-https - DEPRECATED. Forces frontend URLs to use the 'https' scheme. If set to false, - the HTTP scheme is inferred from requests. Default: true. Available only - when hostname:v1 feature is enabled. --hostname-url DEPRECATED. Set the base URL for frontend URLs, including scheme, host, port and path. Available only when hostname:v1 feature is enabled. @@ -385,16 +381,10 @@ Logging: DEPRECATED. Set the format for the GELF timestamp field. Uses Java SimpleDateFormat pattern. Default: yyyy-MM-dd HH:mm:ss,SSS. Available only when GELF is activated. ---log-gelf-version - The GELF version to be used. Possible values are: 1.0, 1.1. Default: 1.1. - Available only when GELF is activated. --log-level The log level of the root category or a comma-separated list of individual categories and their levels. For the root category, you don't need to specify a category. Default: info. ---log-syslog-app-name - The app name used when formatting the message in RFC5424 format. Default: - keycloak. Available only when Syslog is activated. --log-syslog-endpoint The IP address and port of the syslog server. Default: localhost:514. Available only when Syslog is activated. @@ -435,4 +425,4 @@ By default, this command tries to update the server configuration by running a $ kc.sh start '--optimized' By doing that, the server should start faster based on any previous -configuration you have set when manually running the 'build' command. +configuration you have set when manually running the 'build' command. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt index 0df3c2a7c94..475d8243467 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt @@ -177,10 +177,6 @@ Hostname v1 (Deprecated): headers to allow internal and external applications. If all applications use the public URL this option should be enabled. Default: false. Available only when hostname:v1 feature is enabled. ---hostname-strict-https - DEPRECATED. Forces frontend URLs to use the 'https' scheme. If set to false, - the HTTP scheme is inferred from requests. Default: true. Available only - when hostname:v1 feature is enabled. --hostname-url DEPRECATED. Set the base URL for frontend URLs, including scheme, host, port and path. Available only when hostname:v1 feature is enabled. @@ -336,16 +332,10 @@ Logging: DEPRECATED. Set the format for the GELF timestamp field. Uses Java SimpleDateFormat pattern. Default: yyyy-MM-dd HH:mm:ss,SSS. Available only when GELF is activated. ---log-gelf-version - The GELF version to be used. Possible values are: 1.0, 1.1. Default: 1.1. - Available only when GELF is activated. --log-level The log level of the root category or a comma-separated list of individual categories and their levels. For the root category, you don't need to specify a category. Default: info. ---log-syslog-app-name - The app name used when formatting the message in RFC5424 format. Default: - keycloak. Available only when Syslog is activated. --log-syslog-endpoint The IP address and port of the syslog server. Default: localhost:514. Available only when Syslog is activated. @@ -377,4 +367,4 @@ By default, this command tries to update the server configuration by running a $ kc.sh start '--optimized' By doing that, the server should start faster based on any previous -configuration you have set when manually running the 'build' command. +configuration you have set when manually running the 'build' command. \ No newline at end of file