dlmarion commented on code in PR #5599:
URL: https://github.com/apache/accumulo/pull/5599#discussion_r2132633410


##########
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(

Review Comment:
   Yeah, that would be nice.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to