Skip to content

Commit 030b0dc

Browse files
malliaridisepugh
andauthored
SOLR-16824: Replace deprecated single-dash arguments (#2577)
Migrate dash patterns in documentation, various tests, and various user messages generated by tools to reflect the move to --kebab-case and double dashes. --------- Co-authored-by: Eric Pugh <[email protected]>
1 parent b44bdc1 commit 030b0dc

33 files changed

+84
-84
lines changed

solr/CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Improvements
181181

182182
* SOLR-16824: Adopt Linux standard pattern of -- for long option commands, and make all commands "kebab" formatting. I.e -zkHost is now -zk-host. The old parameters
183183
such as -zkHost continue to be supported in the 9.x line of Solr. -u is now used to specify user credentials everywhere, this only impacts the bin/solr assert
184-
commands "same user" check which has -u as the short form of --same-user. (Eric Pugh, janhoy, Jason Gerlowski)
184+
commands "same user" check which has -u as the short form of --same-user. (Eric Pugh, janhoy, Jason Gerlowski, Christos Malliaridis)
185185

186186
* SOLR-17346: Synchronise stopwords from snowball with those in Lucene (Alastair Porter via Houston Putman)
187187

solr/bin/solr.cmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ set FIRST_ARG=%1
246246

247247
IF [%1]==[] goto usage
248248

249+
REM -help is a special case to faciliate folks learning about how to use Solr.
249250
IF "%1"=="-help" goto run_solrcli
250251
IF "%1"=="-usage" goto run_solrcli
251252
IF "%1"=="-h" goto run_solrcli
@@ -293,7 +294,6 @@ IF "%FIRST_ARG%"=="-help" goto run_solrcli
293294
IF "%FIRST_ARG%"=="-usage" goto run_solrcli
294295
IF "%FIRST_ARG%"=="-h" goto run_solrcli
295296
IF "%FIRST_ARG%"=="--help" goto run_solrcli
296-
IF "%FIRST_ARG%"=="-help" goto run_solrcli
297297
IF "%FIRST_ARG%"=="/?" goto run_solrcli
298298
IF "%SCRIPT_CMD%"=="start" goto start_usage
299299
IF "%SCRIPT_CMD%"=="restart" goto start_usage
@@ -316,7 +316,7 @@ goto done
316316
@echo -f Start Solr in foreground; default starts Solr in the background
317317
@echo and sends stdout / stderr to solr-PORT-console.log
318318
@echo.
319-
@echo -c or -cloud Start Solr in SolrCloud mode; if -z not supplied and ZK_HOST not defined in
319+
@echo -c or --cloud Start Solr in SolrCloud mode; if -z not supplied and ZK_HOST not defined in
320320
@echo solr.in.cmd, an embedded ZooKeeper instance is started on Solr port+1000,
321321
@echo such as 9983 if Solr is bound to 8983
322322
@echo.
@@ -1493,10 +1493,10 @@ IF "!ZK_OP!"=="" (
14931493
set CONNECTION_PARAMS=""
14941494

14951495
IF "!ZK_OP!"=="" (
1496-
set CONNECTION_PARAMS="-solrUrl !ZK_SOLR_URL!"
1496+
set CONNECTION_PARAMS="--solr-url !ZK_SOLR_URL!"
14971497
)
14981498
ELSE (
1499-
set CONNECTION_PARAMS="-zkHost ZK_HOST!"
1499+
set CONNECTION_PARAMS="--zk-host ZK_HOST!"
15001500
)
15011501

15021502
IF "!ZK_OP!"=="upconfig" (

solr/core/src/java/org/apache/solr/cli/CreateTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ private void printDefaultConfigsetWarningIfNecessary(CommandLine cli) {
411411
final String configCommand =
412412
String.format(
413413
Locale.ROOT,
414-
"bin/solr config -c %s -solrUrl %s -action set-user-property -property update.autoCreateFields -value false",
414+
"bin/solr config -c %s -s %s --action set-user-property --property update.autoCreateFields --value false",
415415
collectionName,
416416
solrUrl);
417417
echo(

solr/core/src/java/org/apache/solr/cli/PackageTool.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ public void runImpl(CommandLine cli) throws Exception {
205205
: new String[] {};
206206
packageManager.undeploy(packageName, collections, cli.hasOption("cluster"));
207207
} else {
208+
208209
printRed(
209-
"Either specify -cluster to undeploy cluster level plugins or -collections <list-of-collections> to undeploy collection level plugins");
210+
"Either specify --cluster to undeploy cluster level plugins or -collections <list-of-collections> to undeploy collection level plugins");
210211
}
211212
break;
212213
}
@@ -259,7 +260,7 @@ public String getHeader() {
259260
format(sb, "");
260261
formatGreen(
261262
sb,
262-
"bin/solr package deploy <package-name>[:<version>] [-y] [--update] -collections <comma-separated-collections> [-p <param1>=<val1> -p <param2>=<val2> ...] ");
263+
"bin/solr package deploy <package-name>[:<version>] [-y] [--update] --collections <comma-separated-collections> [-p <param1>=<val1> -p <param2>=<val2> ...] ");
263264
format(
264265
sb,
265266
"Bootstraps a previously installed package into the specified collections. It the package accepts parameters for its setup commands, they can be specified (as per package documentation).");
@@ -277,7 +278,7 @@ public String getHeader() {
277278
format(sb, "Print a list of collections on which a given package has been deployed.");
278279
format(sb, "");
279280
formatGreen(
280-
sb, "bin/solr package undeploy <package-name> -collections <comma-separated-collections>");
281+
sb, "bin/solr package undeploy <package-name> --collections <comma-separated-collections>");
281282
format(sb, "Undeploy a package from specified collection(s)");
282283
format(sb, "");
283284
formatGreen(sb, "bin/solr package uninstall <package-name>:<version>");

solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void uninstall(String packageName, String version)
121121
+ packageName
122122
+ " is currently deployed on collection: "
123123
+ collection
124-
+ ". Undeploy the package with undeploy <package-name> -collections <collection1>[,<collection2>,...] before attempting to uninstall the package.");
124+
+ ". Undeploy the package with undeploy <package-name> --collections <collection1>[,<collection2>,...] before attempting to uninstall the package.");
125125
System.exit(1);
126126
}
127127
}
@@ -138,7 +138,7 @@ public void uninstall(String packageName, String version)
138138
+ packageName
139139
+ "is currently deployed as a cluster-level plugin ("
140140
+ clusterPackageInstance.getCustomData()
141-
+ "). Undeploy the package with undeploy <package-name> -collections <collection1>[,<collection2>,...] before uninstalling the package.");
141+
+ "). Undeploy the package with undeploy <package-name> --collections <collection1>[,<collection2>,...] before uninstalling the package.");
142142
System.exit(1);
143143
}
144144
}

solr/core/src/test/org/apache/solr/cli/AuthToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void testEnableAuth() throws Exception {
7070
dir.toAbsolutePath().toString(),
7171
"--solr-include-file",
7272
solrIncludeFile.toAbsolutePath().toString(),
73-
"-credentials",
73+
"--credentials",
7474
"solr:solr",
7575
"--block-unknown",
7676
"true"

solr/core/src/test/org/apache/solr/cli/CreateToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testCreateCollectionWithBasicAuth() throws Exception {
4949
"cloud-minimal",
5050
"-z",
5151
cluster.getZkClient().getZkServerAddress(),
52-
"-credentials",
52+
"--credentials",
5353
SecurityJson.USER_PASS,
5454
"-verbose"
5555
};

solr/core/src/test/org/apache/solr/cli/DeleteToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void testDeleteCollectionWithBasicAuth() throws Exception {
6464
"false",
6565
"-z",
6666
cluster.getZkClient().getZkServerAddress(),
67-
"-credentials",
67+
"--credentials",
6868
SecurityJson.USER_PASS,
6969
"-verbose"
7070
};

solr/core/src/test/org/apache/solr/cli/PostToolTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void testRunWithCollectionParam() throws Exception {
127127
fw.flush();
128128

129129
String[] args = {
130-
"post", "-c", collection, "-credentials", SecurityJson.USER_PASS, jsonDoc.getAbsolutePath()
130+
"post", "-c", collection, "--credentials", SecurityJson.USER_PASS, jsonDoc.getAbsolutePath()
131131
};
132132
assertEquals(0, runTool(args));
133133

@@ -167,7 +167,7 @@ public void testRunCsvWithCustomSeparatorParam() throws Exception {
167167
"post",
168168
"-c",
169169
collection,
170-
"-credentials",
170+
"--credentials",
171171
SecurityJson.USER_PASS,
172172
"--params",
173173
"\"separator=%09&header=false&fieldnames=id,title_s\"",

solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,8 @@ public void testRm() throws Exception {
768768
int res = tool.runTool(SolrCLI.processCommandLineArgs(tool, args));
769769

770770
assertTrue(
771-
"Should have failed to remove node with children unless -recurse is set to true", res != 0);
771+
"Should have failed to remove node with children unless --recurse is set to true",
772+
res != 0);
772773

773774
// Are we sure all the znodes are still there?
774775
verifyZkLocalPathsMatch(srcPathCheck, "/configs/rm1");
@@ -783,7 +784,7 @@ public void testRm() throws Exception {
783784
res = tool.runTool(SolrCLI.processCommandLineArgs(tool, args));
784785

785786
assertTrue(
786-
"Should have failed to remove node with children if -recurse is set to false", res != 0);
787+
"Should have failed to remove node with children if --recurse is set to false", res != 0);
787788

788789
args =
789790
new String[] {

0 commit comments

Comments
 (0)