Update layout for options in guides (#9658)
This commit is contained in:
parent
3dd97f3f2f
commit
b8d3c12a08
6 changed files with 61 additions and 42 deletions
|
@ -1,28 +1,17 @@
|
|||
<#import "/templates/guide.adoc" as template>
|
||||
<#import "/templates/options.adoc" as opts>
|
||||
|
||||
<@template.guide
|
||||
title="All configuration"
|
||||
summary="All the configuration you will ever need and want">
|
||||
|
||||
|
||||
<#list ctx.options.categories as category>
|
||||
<#assign categoryOptions=ctx.options.getValues(category)>
|
||||
<#if categoryOptions?has_content>
|
||||
== ${category.heading}
|
||||
|===
|
||||
|Key|CLI|ENV|Description|Default|Values
|
||||
|
||||
<#list categoryOptions as option>
|
||||
|${option.key}
|
||||
|${option.keyCli}
|
||||
|${option.keyEnv}
|
||||
|${option.description}
|
||||
|${option.defaultValue!}
|
||||
|${option.expectedValues?join(", ")}
|
||||
<#if option?has_next>
|
||||
|
||||
</#if>
|
||||
</#list>
|
||||
|===
|
||||
<@opts.list options=categoryOptions></@opts.list>
|
||||
</#if>
|
||||
</#list>
|
||||
</@template.guide>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<#import "/templates/options.adoc" as opts>
|
||||
|
||||
<#macro guide title summary priority=999 includedOptions="">
|
||||
:guide-id: ${id}
|
||||
:guide-title: ${title}
|
||||
|
@ -12,20 +14,6 @@
|
|||
<#if includedOptions?has_content>
|
||||
== Relevant options
|
||||
|
||||
|===
|
||||
|Key|CLI|ENV|Description|Default|Values
|
||||
|
||||
<#list ctx.options.getOptions(includedOptions) as option>
|
||||
|${option.key}
|
||||
|${option.keyCli}
|
||||
|${option.keyEnv}
|
||||
|${option.description}
|
||||
|${option.defaultValue!}
|
||||
|${option.expectedValues?join(", ")}
|
||||
<#if option?has_next>
|
||||
|
||||
</#if>
|
||||
</#list>
|
||||
|===
|
||||
<@opts.list options=ctx.options.getOptions(includedOptions)></@opts.list>
|
||||
</#if>
|
||||
</#macro>
|
|
@ -3,3 +3,30 @@
|
|||
* ${expectedValue}
|
||||
</#list>
|
||||
</#macro>
|
||||
|
||||
<#macro list options>
|
||||
[cols="12a,4,4,1",role="options"]
|
||||
|===
|
||||
| |Type|Default|
|
||||
|
||||
<#list options as option>
|
||||
|
|
||||
[.options-key]#${option.key}#
|
||||
|
||||
[.options-description]#${option.description}#
|
||||
|
||||
[#option-extended-${option.key},role="options-extended"]
|
||||
!===
|
||||
!<#if option.descriptionExtended?has_content>[.options-description-extended]#${option.descriptionExtended!}#</#if>
|
||||
![.options-description-example]#*CLI:* `${option.keyCli}`#
|
||||
![.options-description-example]#*Env:* `${option.keyEnv}`#
|
||||
!===
|
||||
|<#if option.expectedValues?has_content>[.options-type]#${option.expectedValues?join(", ")}#</#if>
|
||||
|
||||
|<#if option.defaultValue?has_content>[.options-default]#${option.defaultValue!}#</#if>
|
||||
|
||||
|<#if option.build>icon:lock[role=options-build]</#if>
|
||||
</#list>
|
||||
|
||||
|===
|
||||
</#macro>
|
|
@ -41,7 +41,7 @@ public class Options {
|
|||
return this.options.values().stream().filter(o -> o.getKey().matches(r)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static class Option {
|
||||
public class Option {
|
||||
|
||||
private String key;
|
||||
private ConfigCategory category;
|
||||
|
@ -76,7 +76,22 @@ public class Options {
|
|||
}
|
||||
|
||||
public String getDescription() {
|
||||
int i = description.indexOf('.');
|
||||
if (i == -1) {
|
||||
return description;
|
||||
} else {
|
||||
return description.substring(0, i + 1).trim();
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescriptionExtended() {
|
||||
int i = description.indexOf('.');
|
||||
if (i == -1) {
|
||||
return null;
|
||||
} else {
|
||||
String extended = description.substring(i + 1).trim();
|
||||
return extended.length() > 0 ? extended : null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
|
|
|
@ -300,7 +300,7 @@ public final class Picocli {
|
|||
|
||||
private static void addFeatureOptions(CommandSpec commandSpec) {
|
||||
ArgGroupSpec.Builder featureGroupBuilder = ArgGroupSpec.builder()
|
||||
.heading(ConfigCategory.FEATURE.getHeading())
|
||||
.heading(ConfigCategory.FEATURE.getHeading() + ":")
|
||||
.order(ConfigCategory.FEATURE.getOrder())
|
||||
.validate(false);
|
||||
|
||||
|
@ -341,7 +341,7 @@ public final class Picocli {
|
|||
}
|
||||
|
||||
ArgGroupSpec.Builder argGroupBuilder = ArgGroupSpec.builder()
|
||||
.heading(category.getHeading())
|
||||
.heading(category.getHeading() + ":")
|
||||
.order(category.getOrder())
|
||||
.validate(false);
|
||||
|
||||
|
|
|
@ -2,15 +2,15 @@ package org.keycloak.quarkus.runtime.configuration.mappers;
|
|||
|
||||
public enum ConfigCategory {
|
||||
// ordered by name asc
|
||||
CLUSTERING("Cluster:", 10),
|
||||
DATABASE("Database:", 20),
|
||||
FEATURE("Feature:", 30),
|
||||
HOSTNAME("Hostname:", 40),
|
||||
HTTP("HTTP/TLS:", 50),
|
||||
METRICS("Metrics:", 60),
|
||||
PROXY("Proxy:", 70),
|
||||
VAULT("Vault:", 80),
|
||||
GENERAL("General:", 999);
|
||||
CLUSTERING("Cluster", 10),
|
||||
DATABASE("Database", 20),
|
||||
FEATURE("Feature", 30),
|
||||
HOSTNAME("Hostname", 40),
|
||||
HTTP("HTTP/TLS", 50),
|
||||
METRICS("Metrics", 60),
|
||||
PROXY("Proxy", 70),
|
||||
VAULT("Vault", 80),
|
||||
GENERAL("General", 999);
|
||||
|
||||
private final String heading;
|
||||
|
||||
|
|
Loading…
Reference in a new issue