You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2026/10/02 15:52:24 UTC

(solr) branch branch_10x updated: SOLR-18468: Rename --prompt-inputs to --script-inputs (#4927)

This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new eb8692c8b98 SOLR-18468: Rename --prompt-inputs to --script-inputs (#4927)
eb8692c8b98 is described below

commit eb8692c8b987e2ccc6e601168603ccd6f8d20c59
Author: Serhiy Bzhezytskyy <me...@serhiy-bzhezytskyy.com>
AuthorDate: Thu Oct 1 23:16:43 2026 +0300

    SOLR-18468: Rename --prompt-inputs to --script-inputs (#4927)
    
    (cherry picked from commit b4ef2ea2af7d8994b22add6a1cdd0d116c013d4f)
---
 changelog/unreleased/SOLR-18118.yml                |  2 +-
 solr/bin/solr                                      | 10 ++---
 solr/bin/solr.cmd                                  |  8 ++--
 .../java/org/apache/solr/cli/RunExampleTool.java   | 49 +++++++++++-----------
 .../org/apache/solr/cli/TestSolrCLIRunExample.java | 16 +++----
 .../pages/solr-control-script-reference.adoc       |  8 ++--
 6 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/changelog/unreleased/SOLR-18118.yml b/changelog/unreleased/SOLR-18118.yml
index e3d703091ff..5c4bb3f200b 100644
--- a/changelog/unreleased/SOLR-18118.yml
+++ b/changelog/unreleased/SOLR-18118.yml
@@ -1,5 +1,5 @@
 # See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
-title: Script creating a cluster using bin/solr start -e cloud with --prompt-inputs option.
+title: Script creating a cluster using bin/solr start -e cloud with --script-inputs option.
 type: added # added, changed, fixed, deprecated, removed, dependency_update, security, other
 authors:
   - name: Eric Pugh
diff --git a/solr/bin/solr b/solr/bin/solr
index e61808d080c..4d05cb09d45 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -425,7 +425,7 @@ function print_usage() {
     echo ""
     echo "  -y/--no-prompt        Don't prompt for input; accept all defaults when running examples that accept user input."
     echo ""
-    echo "  --prompt-inputs <values> Don't prompt for input; comma delimited list of inputs read when running examples that accept user input."
+    echo "  --script-inputs <values> Don't prompt for input; comma delimited list of inputs read when running examples that accept user input."
     echo ""
     echo "  --force               If attempting to start Solr as the root user, the script will exit with a warning that running Solr as \"root\" can cause problems."
     echo "                          It is possible to override this warning with the '--force' parameter."
@@ -835,14 +835,14 @@ if [ $# -gt 0 ]; then
             PASS_TO_RUN_EXAMPLE+=("--no-prompt")
             shift
         ;;
-        --prompt-inputs)
+        --script-inputs)
         if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
-          print_usage "$SCRIPT_CMD" "Prompt values are required when using the $1 option!"
+          print_usage "$SCRIPT_CMD" "Session input values are required when using the $1 option!"
           exit 1
         fi
-        PASS_TO_RUN_EXAMPLE+=("--prompt-inputs" "$2")
+        PASS_TO_RUN_EXAMPLE+=("--script-inputs" "$2")
         shift 2
-        ;;        
+        ;;
         --verbose)
             verbose=true
             SOLR_LOG_LEVEL=DEBUG
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 743d8fb7cdc..67488161995 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -343,7 +343,7 @@ goto err
 @echo.
 @echo   -y/--no-prompt Don't prompt for input; accept all defaults when running examples that accept user input
 @echo.
-@echo   --prompt-inputs values Don't prompt for input; comma delimited list of inputs read when running examples that accept user input.
+@echo   --script-inputs values Don't prompt for input; comma delimited list of inputs read when running examples that accept user input.
 @echo.
 @echo   --verbose and -q/--quiet Verbose or quiet logging. Sets default log level to DEBUG or WARN instead of INFO
 @echo.
@@ -404,7 +404,7 @@ IF "%1"=="-j" goto set_addl_jetty_config
 IF "%1"=="--jettyconfig" goto set_addl_jetty_config
 IF "%1"=="-y" goto set_noprompt
 IF "%1"=="--no-prompt" goto set_noprompt
-IF "%1"=="--prompt-inputs" goto set_prompt_inputs
+IF "%1"=="--script-inputs" goto set_script_inputs
 
 REM Skip stop arg parsing if not stop command
 IF NOT "%SCRIPT_CMD%"=="stop" goto parse_general_args
@@ -715,8 +715,8 @@ set "PASS_TO_RUN_EXAMPLE=--no-prompt !PASS_TO_RUN_EXAMPLE!"
 SHIFT
 goto parse_args
 
-:set_prompt_inputs
-set "PASS_TO_RUN_EXAMPLE=--prompt-inputs %~2 !PASS_TO_RUN_EXAMPLE!"
+:set_script_inputs
+set "PASS_TO_RUN_EXAMPLE=--script-inputs %~2 !PASS_TO_RUN_EXAMPLE!"
 
 SHIFT
 SHIFT
diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
index 6c0f07b78f7..239a7a16351 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -73,14 +73,14 @@ public class RunExampleTool extends ToolBase {
               "Don't prompt for input; accept all defaults when running examples that accept user input.")
           .get();
 
-  private static final Option PROMPT_INPUTS_OPTION =
+  private static final Option SCRIPT_INPUTS_OPTION =
       Option.builder()
-          .longOpt("prompt-inputs")
+          .longOpt("script-inputs")
           .hasArg()
           .argName("VALUES")
           .desc(
-              "Provide comma-separated values for prompts. Same as --no-prompt but uses provided values instead of defaults. "
-                  + "Example: --prompt-inputs 3,8983,8984,8985,\"gettingstarted\",2,2,_default")
+              "Provide comma-separated values for the interactive session's prompts. Same as --no-prompt but uses provided values instead of defaults. "
+                  + "Example: --script-inputs 3,8983,8984,8985,\"gettingstarted\",2,2,_default")
           .build();
 
   private static final Option EXAMPLE_OPTION =
@@ -186,7 +186,7 @@ public class RunExampleTool extends ToolBase {
   protected Path exampleDir;
   protected Path solrHomeDir;
   protected String urlScheme;
-  private boolean usingPromptInputs = false;
+  private boolean usingScriptInputs = false;
 
   /**
    * Parameters consumed when starting a single Solr node via the bin/solr script, common to all
@@ -214,12 +214,13 @@ public class RunExampleTool extends ToolBase {
   /**
    * Parameters for running the multi-node cloud example, independent of the command line parser.
    *
-   * @param promptInputs comma-separated prompt answers, or null when prompting interactively
+   * @param scriptInputs comma-separated answers to the example's prompts, or null to run the
+   *     interactive session instead
    * @param zkHost ZooKeeper connection string resolved from option or sysprop, or null
    * @param basePort first node port; remaining nodes use basePort+1..+3 unless prompted otherwise
    */
   record CloudExampleParams(
-      boolean noPrompt, String promptInputs, String zkHost, int basePort, StartSolrParams start) {}
+      boolean noPrompt, String scriptInputs, String zkHost, int basePort, StartSolrParams start) {}
 
   /** Default constructor used by the framework when running as a command-line application. */
   public RunExampleTool(ToolRuntime runtime) {
@@ -241,7 +242,7 @@ public class RunExampleTool extends ToolBase {
   public Options getOptions() {
     return super.getOptions()
         .addOption(NO_PROMPT_OPTION)
-        .addOption(PROMPT_INPUTS_OPTION)
+        .addOption(SCRIPT_INPUTS_OPTION)
         .addOption(EXAMPLE_OPTION)
         .addOption(SCRIPT_OPTION)
         .addOption(SERVER_DIR_OPTION)
@@ -259,10 +260,10 @@ public class RunExampleTool extends ToolBase {
 
   @Override
   public void runImpl(CommandLine cli) throws Exception {
-    if (cli.hasOption(NO_PROMPT_OPTION) && cli.hasOption(PROMPT_INPUTS_OPTION)) {
+    if (cli.hasOption(NO_PROMPT_OPTION) && cli.hasOption(SCRIPT_INPUTS_OPTION)) {
       throw new IllegalArgumentException(
-          "Cannot use both --no-prompt and --prompt-inputs options together. "
-              + "Use --no-prompt to accept defaults, or --prompt-inputs to provide specific values.");
+          "Cannot use both --no-prompt and --script-inputs options together. "
+              + "Use --no-prompt to accept defaults, or --script-inputs to provide specific values.");
     }
 
     this.urlScheme = cli.getOptionValue(URL_SCHEME_OPTION, "http");
@@ -315,7 +316,7 @@ public class RunExampleTool extends ToolBase {
       runCloudExample(
           new CloudExampleParams(
               cli.hasOption(NO_PROMPT_OPTION),
-              cli.getOptionValue(PROMPT_INPUTS_OPTION),
+              cli.getOptionValue(SCRIPT_INPUTS_OPTION),
               zkHost,
               port,
               startParams));
@@ -608,7 +609,7 @@ public class RunExampleTool extends ToolBase {
 
   void runCloudExample(CloudExampleParams params) throws Exception {
 
-    usingPromptInputs = params.promptInputs() != null;
+    usingScriptInputs = params.scriptInputs() != null;
     boolean prompt = !params.noPrompt();
     int numNodes = 2;
     int[] cloudPorts = new int[] {8983, 7574, 8984, 7575};
@@ -622,20 +623,20 @@ public class RunExampleTool extends ToolBase {
     echo("\nWelcome to the SolrCloud example!\n");
 
     Scanner readInput = null;
-    if (usingPromptInputs) {
-      // Create a scanner from the provided prompts
-      String promptsValue = params.promptInputs();
-      InputStream promptsStream =
-          new ByteArrayInputStream(promptsValue.getBytes(StandardCharsets.UTF_8));
-      readInput = new Scanner(promptsStream, StandardCharsets.UTF_8);
+    if (usingScriptInputs) {
+      // Create a scanner from the provided script inputs
+      String scriptInputsValue = params.scriptInputs();
+      InputStream scriptInputsStream =
+          new ByteArrayInputStream(scriptInputsValue.getBytes(StandardCharsets.UTF_8));
+      readInput = new Scanner(scriptInputsStream, StandardCharsets.UTF_8);
       readInput.useDelimiter(",");
-      prompt = true; // Enable prompting code path, but reading from prompts instead of user
+      prompt = true; // Enable prompting code path, but reading from script inputs instead of user
     } else if (prompt) {
       readInput = new Scanner(userInput, StandardCharsets.UTF_8);
     }
 
     if (prompt) {
-      if (!usingPromptInputs) {
+      if (!usingScriptInputs) {
         echo(
             "This interactive session will help you launch a SolrCloud cluster on your local workstation.");
       }
@@ -1225,10 +1226,10 @@ public class RunExampleTool extends ToolBase {
   protected String prompt(Scanner s, String prompt, String defaultValue) {
     echo(prompt);
     String nextInput;
-    if (usingPromptInputs) {
-      // Reading from prompts option - use next() instead of nextLine()
+    if (usingScriptInputs) {
+      // Reading from script-inputs option - use next() instead of nextLine()
       nextInput = s.hasNext() ? s.next() : null;
-      // Echo the value being used from prompts
+      // Echo the value being used from script inputs
       if (nextInput != null) {
         echo(nextInput);
       }
diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
index 2e2157878ae..f290115486c 100644
--- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
+++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
@@ -522,11 +522,11 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
   }
 
   /**
-   * Test the --prompt-inputs option that allows providing all prompt values as a comma-separated
+   * Test the --script-inputs option that allows providing all prompt values as a comma-separated
    * string without requiring interactive input.
    */
   @Test
-  public void testSolrCloudExampleWithPrompts() throws Exception {
+  public void testSolrCloudExampleWithScriptInputs() throws Exception {
     Path solrHomeDir = ExternalPaths.SERVER_HOME;
     if (!Files.isDirectory(solrHomeDir))
       fail(solrHomeDir + " not found and is required to run this test!");
@@ -539,11 +539,11 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
       bindPort = socket.getLocalPort();
     }
 
-    String collectionName = "testCloudExampleWithPrompts";
+    String collectionName = "testCloudExampleWithScriptInputs";
 
-    // Provide all prompt values via --prompt-inputs option:
+    // Provide all prompt values via --script-inputs option:
     // numNodes, port1, collectionName, numShards, replicationFactor, configName
-    String promptsValue = "1," + bindPort + ",\"" + collectionName + "\",2,2,_default";
+    String scriptInputsValue = "1," + bindPort + ",\"" + collectionName + "\",2,2,_default";
 
     String[] toolArgs =
         new String[] {
@@ -553,8 +553,8 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
           solrServerDir.toString(),
           "--example-dir",
           solrExampleDir.toString(),
-          "--prompt-inputs",
-          promptsValue
+          "--script-inputs",
+          scriptInputsValue
         };
 
     // capture tool output to stdout
@@ -581,7 +581,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
     String solrUrl = "http://localhost:" + bindPort + "/solr";
     if (!CLIUtils.safeCheckCollectionExists(solrUrl, collectionName, null)) {
       fail(
-          "After running Solr cloud example with --prompt-inputs, test collection '"
+          "After running Solr cloud example with --script-inputs, test collection '"
               + collectionName
               + "' not found in Solr at: "
               + solrUrl
diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc
index aae46c7c6cc..116957b3ad7 100644
--- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc
+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc
@@ -277,7 +277,7 @@ If you want to accept all of the defaults, you can simply add the `--no-prompt`
 +
 *Example*: `bin/solr start -e cloud --no-prompt`
 
-`--prompt-inputs <values>`::
+`--script-inputs <values>`::
 +
 [%autowidth,frame=none]
 |===
@@ -286,11 +286,11 @@ If you want to accept all of the defaults, you can simply add the `--no-prompt`
 +
 Don't prompt for input; instead supply ordered answers in comma delimited format when running examples that accept input.
 +
-For example, when using the "cloud" example, you can answer the prompts non-interactively to start a three node cluster on specific ports:
+For example, when using the "cloud" example, you can answer the interactive session's questions non-interactively to start a three node cluster on specific ports:
 +
-*Example*: `bin/solr start -e cloud --prompt-inputs 3,9000,9001,9002,"mycollection",2,2,_default`
+*Example*: `bin/solr start -e cloud --script-inputs 3,9000,9001,9002,"mycollection",2,2,_default`
 
-On Windows please wrap the prompts value in double quotes to preserve the comma delimited format.
+On Windows please wrap the script-inputs value in double quotes to preserve the comma delimited format.
 
 It is not necessary to define all of the options when starting if the defaults are fine for your needs.