janhoy commented on code in PR #5039:
URL: https://github.com/apache/solr/pull/5039#discussion_r4205437484


##########
changelog/unreleased/SOLR-18512-picocli-config.yml:
##########
@@ -0,0 +1,9 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+
+title: The `config` command is now available in the experimental picocli 
command line interface.

Review Comment:
   Dropping the `-v` short form of `--value` on the picocli path is the right 
call (it collides with `-v/--verbose`), but it is a user-visible difference: 
`bin/solr config -c x --property p -v 10` works today and under picocli becomes 
"verbose on, value missing". Please say so in this changelog entry (e.g. "…; in 
the picocli CLI `--value` has no `-v` short form, use `--value`") so it is 
discoverable, not only in the code comment.



##########
solr/core/src/java/org/apache/solr/cli/ConfigTool.java:
##########
@@ -81,6 +113,68 @@ record ConfigParams(
       String value,
       String credentials) {}
 
+  // --- picocli fields ---
+
+  @picocli.CommandLine.ArgGroup(exclusive = true, multiplicity = "0..1")
+  private ConnectionOptions connectionOptions;
+
+  @picocli.CommandLine.Mixin private CredentialsOptions credentialsOptions;
+
+  @picocli.CommandLine.Option(
+      names = {"-c", "--name"},
+      required = true,
+      paramLabel = "NAME",
+      description = "Name of the collection.")
+  private String nameOpt;
+
+  /** The values of {@code --action}, spelled on the command line as {@link 
#toString()} says. */
+  enum Action {
+    SET_PROPERTY("set-property"),
+    UNSET_PROPERTY("unset-property"),
+    SET_USER_PROPERTY("set-user-property"),
+    UNSET_USER_PROPERTY("unset-user-property");
+
+    private final String id;
+
+    Action(String id) {
+      this.id = id;
+    }
+
+    @Override
+    public String toString() {
+      return id;
+    }
+  }
+
+  @picocli.CommandLine.Option(
+      names = {"-a", "--action"},
+      defaultValue = "set-property",
+      paramLabel = "ACTION",
+      description =
+          "Config API action, one of: ${COMPLETION-CANDIDATES}; default is 
'${DEFAULT-VALUE}'.")
+  private Action actionOpt;
+
+  @picocli.CommandLine.Option(
+      names = "--property",
+      required = true,
+      paramLabel = "PROP",
+      description =
+          "Name of the Config API property to apply the action to, such as:"
+              + " 'updateHandler.autoSoftCommit.maxTime'.")
+  private String propertyOpt;
+
+  // Long-only: "-v" is ToolBase's --verbose, and picocli rejects a duplicate 
short name. Under
+  // commons-cli the later-added VALUE_OPTION wins, so there "-v" still means 
--value.
+  @picocli.CommandLine.Option(
+      names = "--value",

Review Comment:
   (See the changelog comment — the `-v` divergence should be documented there.)



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to