malliaridis commented on code in PR #2690:
URL: https://github.com/apache/solr/pull/2690#discussion_r1741974114


##########
solr/core/src/java/org/apache/solr/cli/ConfigTool.java:
##########
@@ -93,9 +109,13 @@ public void runImpl(CommandLine cli) throws Exception {
     String solrUrl = SolrCLI.normalizeSolrUrl(cli);
     String action = cli.getOptionValue("action", "set-property");
     String collection = cli.getOptionValue("name");
-    String property = cli.getOptionValue("property");
+    String property = SolrCLI.getOptionWithDeprecatedAndDefault(cli, 
"property", "p", null);
     String value = cli.getOptionValue("value");
 
+    if (property == null) {
+      throw new IllegalArgumentException("'property' is a required option.");

Review Comment:
   Should we consider throwing a 
[MissingArgumentException](https://commons.apache.org/proper/commons-cli/javadocs/api-release/src-html/org/apache/commons/cli/MissingArgumentException.html)
 like commons-cli would do?



##########
solr/core/src/java/org/apache/solr/cli/ConfigTool.java:
##########
@@ -66,11 +67,26 @@ public List<Option> getOptions() {
             .desc(
                 "Config API action, one of: set-property, unset-property, 
set-user-property, unset-user-property; default is 'set-property'.")
             .build(),
-        Option.builder("p")
+        Option.builder()
             .longOpt("property")
             .argName("PROP")
             .hasArg()
-            .required(true)
+            .required(
+                false) // Should be TRUE but have a deprecated option to deal 
with first, so we

Review Comment:
   FYI commons-cli provides an `OptionGroup` for such cases, so we may consider 
using it in the future to optimize the logic in all CLI classes.



-- 
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: issues-unsubscr...@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to