dlmarion commented on code in PR #5599:
URL: https://github.com/apache/accumulo/pull/5599#discussion_r2132633083
##########
core/src/main/java/org/apache/accumulo/core/cli/ConfigOpts.java:
##########
@@ -106,4 +112,113 @@ public void parseArgs(String programName, String[] args,
Object... others) {
}
}
}
+
+ @Override
+ public String getAdditionalHelpInformation(String programName) {
+
+ final Set<String> validPrefixes = new HashSet<>();
+
+ switch (programName) {
+ case "compactor":
+ validPrefixes.add(Property.COMPACTOR_PREFIX.getKey());
+ break;
+ case "compaction-coordinator":
+ validPrefixes.add(Property.COMPACTION_COORDINATOR_PREFIX.getKey());
+ break;
+ case "gc":
+ validPrefixes.add(Property.GC_PREFIX.getKey());
+ break;
+ case "manager":
+ validPrefixes.add(Property.MANAGER_PREFIX.getKey());
+ break;
+ case "monitor":
+ validPrefixes.add(Property.MONITOR_PREFIX.getKey());
+ break;
+ case "sserver":
+ validPrefixes.add(Property.SSERV_PREFIX.getKey());
+ break;
+ case "tserver":
+ validPrefixes.add(Property.TSERV_PREFIX.getKey());
+ break;
+ default:
+ break;
+ }
+
+ if (validPrefixes.isEmpty()) {
+ // We only provide extra help information for server processes
+ return null;
+ }
+
+ // print out possible property overrides for the -o argument.
+ validPrefixes.add(Property.GENERAL_PREFIX.getKey());
+ validPrefixes.add(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey());
+ validPrefixes.add(Property.RPC_PREFIX.getKey());
+
+ // Determine format lengths based on property names and default values
+ int maxPropLength = 0;
+ int maxDefaultLength = 0;
+ for (Property prop : Property.values()) {
+ if (prop.getKey().length() > maxPropLength) {
+ maxPropLength = prop.getKey().length();
+ }
+ if (prop.getDefaultValue() != null && prop.getDefaultValue().length() >
maxDefaultLength) {
+ maxDefaultLength = prop.getDefaultValue().length();
+ }
+ }
+
+ final String propOnlyFormat =
+ "%1$-" + maxPropLength + "s %2$-" + Math.min(52, maxDefaultLength) +
"s";
+ final String deprecatedOnlyFormat = propOnlyFormat + " (deprecated)";
+ final String replacedFormat = propOnlyFormat + " (deprecated - replaced by
%3$s)";
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(
+ "\tBelow are the properties, and their default values, that can be
used with the '-o' (overrides) option.\n");
+ sb.append("\tLong default values will be truncated.\n");
+ sb.append(
+ "\tSee the user guide at https://accumulo.apache.org/ for more
information about each property.\n");
Review Comment:
Tabs have been removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]