Apache Solr open-source search software
SOLR-16870: remove now dead lines of code (#1759)
Eric Pugh58f1761b0d16
diff --git a/solr/bin/solr b/solr/bin/solrindex 45aa5a108b5..09053117057 100644--- a/solr/bin/solr+++ b/solr/bin/solr@@ -339,25 +339,7 @@ function print_usage() {echo -e "\nERROR: $ERROR_MSG\n"fi- if [ -z "${CMD:-}" ]; then- echo ""- echo "Usage: solr COMMAND OPTIONS"- echo " where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete, version, zk, auth, assert, config, export, api, package"- echo ""- echo " Standalone server example (start Solr running in the background on port 8984):"- echo ""- echo " ./solr start -p 8984"- echo ""- echo " SolrCloud example (start Solr running in SolrCloud mode using localhost:2181 to connect to Zookeeper, with 1g max heap size and remote Java debug options enabled):"- echo ""- echo " ./solr start -c -m 1g -z localhost:2181 -a \"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044\""- echo ""- echo " Omit '-z localhost:2181' from the above command if you have defined ZK_HOST in solr.in.sh."- echo ""- echo "Pass -help or -h after any COMMAND to see command-specific usage information,"- echo " such as: ./solr start -help or ./solr stop -h"- echo ""- elif [[ "$CMD" == "start" || "$CMD" == "restart" ]]; then+ if [[ "$CMD" == "start" || "$CMD" == "restart" ]]; thenecho ""echo "Usage: solr $CMD [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a \"additional-options\"] [-V]"echo ""diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex e38f3645f17..ae16c5dacb5 100755--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -223,11 +223,11 @@ set FIRST_ARG=%1IF [%1]==[] goto usage-IF "%1"=="-help" goto usage-IF "%1"=="-usage" goto usage-IF "%1"=="-h" goto usage-IF "%1"=="--help" goto usage-IF "%1"=="/?" goto usage+IF "%1"=="-help" goto run_solrcli+IF "%1"=="-usage" goto run_solrcli+IF "%1"=="-h" goto run_solrcli+IF "%1"=="--help" goto run_solrcli+IF "%1"=="/?" goto run_solrcliIF "%1"=="status" goto get_statusIF "%1"=="version" goto run_solrcliIF "%1"=="-v" goto run_solrcli@@ -264,12 +264,12 @@ goto parse_args:usageIF NOT "%SCRIPT_ERROR%"=="" ECHO %SCRIPT_ERROR%-IF [%FIRST_ARG%]==[] goto script_usage-IF "%FIRST_ARG%"=="-help" goto script_usage-IF "%FIRST_ARG%"=="-usage" goto script_usage-IF "%FIRST_ARG%"=="-h" goto script_usage-IF "%FIRST_ARG%"=="--help" goto script_usage-IF "%FIRST_ARG%"=="/?" goto script_usage+IF [%FIRST_ARG%]==[] goto run_solrcli+IF "%FIRST_ARG%"=="-help" goto run_solrcli+IF "%FIRST_ARG%"=="-usage" goto run_solrcli+IF "%FIRST_ARG%"=="-h" goto run_solrcli+IF "%FIRST_ARG%"=="--help" goto run_solrcli+IF "%FIRST_ARG%"=="/?" goto run_solrcliIF "%SCRIPT_CMD%"=="start" goto start_usageIF "%SCRIPT_CMD%"=="restart" goto start_usageIF "%SCRIPT_CMD%"=="stop" goto stop_usage@@ -283,26 +283,6 @@ IF "%SCRIPT_CMD%"=="auth" goto auth_usageIF "%SCRIPT_CMD%"=="status" goto run_solrcligoto done-:script_usage-@echo.-@echo Usage: solr COMMAND OPTIONS-@echo where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete, version, zk, auth, assert, config, export, api, package-@echo.-@echo Standalone server example (start Solr running in the background on port 8984):-@echo.-@echo solr start -p 8984-@echo.-@echo SolrCloud example (start Solr running in SolrCloud mode using localhost:2181 to connect to Zookeeper, with 1g max heap size and remote Java debug options enabled):-@echo.-@echo solr start -c -m 1g -z localhost:2181 -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"-@echo.-@echo Omit '-z localhost:2181' from the above command if you have defined ZK_HOST in solr.in.cmd.-@echo.-@echo Pass -help after any COMMAND to see command-specific usage information,-@echo such as: solr start -help or solr stop -help-@echo.-goto done-:start_usage@echo.@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a "additional-options"] [-V]@@ -1665,8 +1645,6 @@ IF "%FIRST_ARG%"=="start" (goto auth_usage) ELSE IF "%FIRST_ARG%"=="status" (goto run_solrcli-) ELSE (- goto script_usage):need_java_homediff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.javaindex 28de99ce25b..c7eff7622d1 100755--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java@@ -120,7 +120,12 @@ public class SolrCLI implements CLIO {/** Runs a tool. */public static void main(String[] args) throws Exception {- if (args == null || args.length == 0 || args[0] == null || args[0].trim().length() == 0) {+ final boolean hasNoCommand =+ args == null || args.length == 0 || args[0] == null || args[0].trim().length() == 0;+ final boolean isHelpCommand =+ !hasNoCommand && Arrays.asList("-h", "--help", "/?").contains(args[0]);++ if (hasNoCommand || isHelpCommand) {printHelp();exit(1);}