Apache Solr open-source search software
SOLR-16822: fix -h meaning help and hostname for start and restart. (#1819)
Eric Pugh6bcf1b7d7fe1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex d2fd1e5556e..0745371a5ea 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -57,6 +57,8 @@ Other Changes* SOLR-16892: bin/solr create command supports both standalone and cloud modes, and deprecate create_core and create_collection commands. (Eric Pugh)+* SOLR-16822: Change meaning of -h from shorhand for -host to instead return help information for bin/solr start and restart commands. (Eric Pugh)+================== 9.4.0 ==================New Features---------------------diff --git a/solr/bin/solr b/solr/bin/solrindex e78693bba29..1a91582678d 100644--- a/solr/bin/solr+++ b/solr/bin/solr@@ -350,7 +350,7 @@ function print_usage() {echo " solr.in.sh, an embedded ZooKeeper instance is started on Solr port+1000,"echo " such as 9983 if Solr is bound to 8983"echo ""- echo " -h/-host <host> Specify the hostname for this Solr instance"+ echo " -host <host> Specify the hostname for this Solr instance"echo ""echo " -p <port> Specify the port to start the Solr HTTP listener on; default is 8983"echo " The specified port (SOLR_PORT) will also be used to determine the stop port"@@ -1270,13 +1270,13 @@ if [ $# -gt 0 ]; thenFG="true"shift;;- -h|-host)+ -host)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Hostname is required when using the $1 option!"exit 1fiSOLR_HOST="$2"- PASS_TO_RUN_EXAMPLE+=("-h" "$SOLR_HOST")+ PASS_TO_RUN_EXAMPLE+=("-host" "$SOLR_HOST")shift 2;;-m|-memory)diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex f133a45d471..71e3ab42bee 100755--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -292,7 +292,7 @@ goto done@echo solr.in.cmd, an embedded ZooKeeper instance is started on Solr port+1000,@echo such as 9983 if Solr is bound to 8983@echo.-@echo -h host Specify the hostname for this Solr instance+@echo -host host Specify the hostname for this Solr instance@echo.@echo -p port Specify the port to start the Solr HTTP listener on; default is 8983@echo The specified port (SOLR_PORT) will also be used to determine the stop port@@ -503,6 +503,7 @@ set "firstTwo=%arg:~0,2%"IF "%SCRIPT_CMD%"=="" set SCRIPT_CMD=startIF [%1]==[] goto process_script_cmdIF "%1"=="-help" goto usage+IF "%1"=="-h" goto usageIF "%1"=="-usage" goto usageIF "%1"=="/?" goto usageIF "%1"=="-f" goto set_foreground_mode@@ -520,7 +521,6 @@ IF "%1"=="-t" goto set_solr_data_dirIF "%1"=="-solr.home" goto set_solr_home_dirIF "%1"=="-e" goto set_exampleIF "%1"=="-example" goto set_example-IF "%1"=="-h" goto set_hostIF "%1"=="-host" goto set_hostIF "%1"=="-m" goto set_memoryIF "%1"=="-memory" goto set_memorydiff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.batsindex c2fb863cd46..a6a8a497b36 100644--- a/solr/packaging/test/test_help.bats+++ b/solr/packaging/test/test_help.bats@@ -38,6 +38,14 @@ setup() {refute_output --partial 'ERROR'}+@test "start h flag prints help" {+ run solr start -h+ assert_output --partial 'Usage: solr start'+ refute_output --partial 'ERROR: Hostname is required when using the -h option!'+}+++@test "stop help flag prints help" {run solr stop -helpassert_output --partial 'Usage: solr stop'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.adocindex 80eaebf4cef..12e1a4ea0f6 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@@ -142,7 +142,7 @@ You cannot use this option when running examples with the `-e` option.+*Example*: `bin/solr start -f`-`-host <hostname>` or `-h <hostname>`::+`-host <hostname>`::+[%autowidth,frame=none]|===@@ -152,7 +152,7 @@ You cannot use this option when running examples with the `-e` option.Specify the hostname for this Solr instance.If this is not specified, `localhost` is assumed.+-*Example*: `bin/solr start -h search.mysolr.com`+*Example*: `bin/solr start -host search.mysolr.com``-m <memory>`::+