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/guide.adoc" as template>
|
||||||
|
<#import "/templates/options.adoc" as opts>
|
||||||
|
|
||||||
<@template.guide
|
<@template.guide
|
||||||
title="All configuration"
|
title="All configuration"
|
||||||
summary="All the configuration you will ever need and want">
|
summary="All the configuration you will ever need and want">
|
||||||
|
|
||||||
|
|
||||||
<#list ctx.options.categories as category>
|
<#list ctx.options.categories as category>
|
||||||
<#assign categoryOptions=ctx.options.getValues(category)>
|
<#assign categoryOptions=ctx.options.getValues(category)>
|
||||||
<#if categoryOptions?has_content>
|
<#if categoryOptions?has_content>
|
||||||
== ${category.heading}
|
== ${category.heading}
|
||||||
|===
|
|
||||||
|Key|CLI|ENV|Description|Default|Values
|
|
||||||
|
|
||||||
<#list categoryOptions as option>
|
<@opts.list options=categoryOptions></@opts.list>
|
||||||
|${option.key}
|
|
||||||
|${option.keyCli}
|
|
||||||
|${option.keyEnv}
|
|
||||||
|${option.description}
|
|
||||||
|${option.defaultValue!}
|
|
||||||
|${option.expectedValues?join(", ")}
|
|
||||||
<#if option?has_next>
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
</#list>
|
|
||||||
|===
|
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
</@template.guide>
|
</@template.guide>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
<#import "/templates/options.adoc" as opts>
|
||||||
|
|
||||||
<#macro guide title summary priority=999 includedOptions="">
|
<#macro guide title summary priority=999 includedOptions="">
|
||||||
:guide-id: ${id}
|
:guide-id: ${id}
|
||||||
:guide-title: ${title}
|
:guide-title: ${title}
|
||||||
|
@ -12,20 +14,6 @@
|
||||||
<#if includedOptions?has_content>
|
<#if includedOptions?has_content>
|
||||||
== Relevant options
|
== Relevant options
|
||||||
|
|
||||||
|===
|
<@opts.list options=ctx.options.getOptions(includedOptions)></@opts.list>
|
||||||
|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>
|
|
||||||
|===
|
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
|
@ -3,3 +3,30 @@
|
||||||
* ${expectedValue}
|
* ${expectedValue}
|
||||||
</#list>
|
</#list>
|
||||||
</#macro>
|
</#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());
|
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 String key;
|
||||||
private ConfigCategory category;
|
private ConfigCategory category;
|
||||||
|
@ -76,7 +76,22 @@ public class Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
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() {
|
public String getDefaultValue() {
|
||||||
|
|
|
@ -300,7 +300,7 @@ public final class Picocli {
|
||||||
|
|
||||||
private static void addFeatureOptions(CommandSpec commandSpec) {
|
private static void addFeatureOptions(CommandSpec commandSpec) {
|
||||||
ArgGroupSpec.Builder featureGroupBuilder = ArgGroupSpec.builder()
|
ArgGroupSpec.Builder featureGroupBuilder = ArgGroupSpec.builder()
|
||||||
.heading(ConfigCategory.FEATURE.getHeading())
|
.heading(ConfigCategory.FEATURE.getHeading() + ":")
|
||||||
.order(ConfigCategory.FEATURE.getOrder())
|
.order(ConfigCategory.FEATURE.getOrder())
|
||||||
.validate(false);
|
.validate(false);
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public final class Picocli {
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgGroupSpec.Builder argGroupBuilder = ArgGroupSpec.builder()
|
ArgGroupSpec.Builder argGroupBuilder = ArgGroupSpec.builder()
|
||||||
.heading(category.getHeading())
|
.heading(category.getHeading() + ":")
|
||||||
.order(category.getOrder())
|
.order(category.getOrder())
|
||||||
.validate(false);
|
.validate(false);
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@ package org.keycloak.quarkus.runtime.configuration.mappers;
|
||||||
|
|
||||||
public enum ConfigCategory {
|
public enum ConfigCategory {
|
||||||
// ordered by name asc
|
// ordered by name asc
|
||||||
CLUSTERING("Cluster:", 10),
|
CLUSTERING("Cluster", 10),
|
||||||
DATABASE("Database:", 20),
|
DATABASE("Database", 20),
|
||||||
FEATURE("Feature:", 30),
|
FEATURE("Feature", 30),
|
||||||
HOSTNAME("Hostname:", 40),
|
HOSTNAME("Hostname", 40),
|
||||||
HTTP("HTTP/TLS:", 50),
|
HTTP("HTTP/TLS", 50),
|
||||||
METRICS("Metrics:", 60),
|
METRICS("Metrics", 60),
|
||||||
PROXY("Proxy:", 70),
|
PROXY("Proxy", 70),
|
||||||
VAULT("Vault:", 80),
|
VAULT("Vault", 80),
|
||||||
GENERAL("General:", 999);
|
GENERAL("General", 999);
|
||||||
|
|
||||||
private final String heading;
|
private final String heading;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue