serhiy-bzhezytskyy commented on code in PR #5050:
URL: https://github.com/apache/solr/pull/5050#discussion_r4207435977
##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -222,6 +307,122 @@ record RunExampleParams(boolean isCloudMode, String
zkHost, int port, StartSolrP
record CloudExampleParams(
boolean noPrompt, String scriptInputs, String zkHost, int basePort,
StartSolrParams start) {}
+ // --- picocli fields ---
+
+ @picocli.CommandLine.Option(
+ names = {"-y", "--no-prompt"},
+ description =
+ "Don't prompt for input; accept all defaults when running examples
that accept user"
+ + " input.")
+ private boolean noPromptOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--script-inputs",
+ paramLabel = "VALUES",
+ description =
+ "Provide comma-separated values for prompts. Same as --no-prompt but
uses provided"
+ + " values instead of defaults. Example: --script-inputs"
+ + " 3,8983,8984,8985,\"gettingstarted\",2,2,_default")
+ private String scriptInputsOpt;
+
+ @picocli.CommandLine.Option(
+ names = {"-e", "--example"},
+ required = true,
+ paramLabel = "NAME",
+ description =
+ "Name of the example to launch, one of: cloud, techproducts,
schemaless, films.")
+ private String exampleOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--script",
+ paramLabel = "PATH",
+ description = "Path to the bin/solr script.")
+ private String scriptOpt;
+
+ @picocli.CommandLine.Option(
+ names = {"-d", "--server-dir"},
+ required = true,
+ paramLabel = "DIR",
+ description = "Path to the Solr server directory.")
+ private String serverDirOpt;
+
+ @picocli.CommandLine.Option(
+ names = {"-f", "--force"},
+ description = "Force option in case Solr is run as root.")
+ private boolean forceOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--example-dir",
+ paramLabel = "DIR",
+ description =
+ "Path to the Solr example directory; if not provided,
${serverDir}/../example is"
+ + " expected to exist.")
+ private String exampleDirOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--solr-home",
+ paramLabel = "SOLR_HOME_DIR",
+ description =
+ "Path to the Solr home directory; if not provided, ${serverDir}/solr
is expected to"
+ + " exist.")
+ private String solrHomeOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--url-scheme",
+ defaultValue = "http",
+ paramLabel = "SCHEME",
+ description = "Solr URL scheme: http or https, defaults to http if not
specified.")
+ private String urlSchemeOpt;
+
+ // No explicit paramLabel: the default "<port>" is what
CliDefaultValueProvider keys on, giving
+ // the solr.port.listen property / SOLR_PORT_LISTEN, else 8983, as under
commons-cli.
+ @picocli.CommandLine.Option(
+ names = {"-p", "--port"},
+ description = "Specify the port to start the Solr HTTP listener on;
default is 8983.")
+ private int port;
+
+ @picocli.CommandLine.Option(
+ names = "--host",
+ paramLabel = "HOSTNAME",
+ description = "Specify the hostname for this Solr instance.")
+ private String hostOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--user-managed",
+ description = "Start Solr in User Managed mode.")
+ private boolean userManagedOpt;
+
+ @picocli.CommandLine.Option(
+ names = {"-m", "--memory"},
+ paramLabel = "MEM",
+ description =
+ "Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as:
-m 4g results in:"
+ + " -Xms4g -Xmx4g; by default, this script sets the heap size to
512m.")
+ private String memoryOpt;
+
+ @picocli.CommandLine.Option(
+ names = "--jvm-opts",
+ paramLabel = "OPTS",
+ description =
+ "Additional options to be passed to the JVM when starting example
Solr server(s).")
+ private String jvmOptsOpt;
+
+ // Likewise "<zkHost>": the zkHost property / ZK_HOST, else null.
+ @picocli.CommandLine.Option(
+ names = {"-z", "--zk-host"},
+ description = "Zookeeper connection string.")
+ private String zkHost;
+
+ @picocli.CommandLine.Parameters(
+ arity = "0..*",
+ paramLabel = "ARG",
+ description = "Extra arguments passed through to the underlying bin/solr
start command.")
+ private String[] extraArgsOpt = new String[0];
Review Comment:
Fixed in e59118c: `-D…` arguments are kept as extra arguments after the
positional ones, and any other unknown option still gives picocli's usage error
(exit 2). Checked with `bin/solr start -e techproducts -Dcustom.prop=1`.
--
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]