Repository navigation
SOLR-18561 | Flipping CLI default flag to PicoCLI #5190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b2f7c16
61dfce9
082e6fa
c222ea4
2fcdd1d
60d820f
c19c3e5
67d4521
394c7bb
5419b3e
e485374
d4f54f2
86b6c83
83c1af7
1e42f5a
5b80836
9559894
f7e3279
630c07d
f76e058
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,26 +338,38 @@ def configureBatsTask(BatsTask task, String outputName, boolean usePicocli) { | |
| task.environment TEST_OUTPUT_DIR: integrationTestOutput | ||
| task.environment TEST_FAILURE_DIR: solrTestFailuresDir | ||
| task.environment BATS_LIB_PREFIX: batsLibsDir | ||
| if (usePicocli) { | ||
| task.environment SOLR_PICOCLI: 'true' | ||
| if (!usePicocli) { | ||
| task.environment SOLR_PICOCLI: 'false' | ||
| } | ||
| } | ||
|
|
||
| // TODO: Remove this when cleaning up commons-cli | ||
| task integrationTests(type: BatsTask) { | ||
| description = 'Runs the BATS suites for the CLI powered by commons-cli.' | ||
| configureBatsTask(it, 'test-output', false) | ||
| } | ||
|
|
||
| // The same suites run against the experimental picocli CLI. Deliberately a curated list rather | ||
| // than the whole suite, so the run stays short. A change that ports another tool to picocli | ||
| // should add that tool's .bats file here. | ||
| // The same suites run against the picocli CLI. | ||
| task integrationTestsPicocli(type: BatsTask) { | ||
| description = 'Runs the BATS suites for the migrated commands against the experimental picocli CLI.' | ||
| description = 'Runs the BATS suites for the CLI powered by PicoCLI.' | ||
| configureBatsTask(it, 'test-output-picocli', true) | ||
| // A suite belongs here only when every command it invokes has been migrated, not merely the | ||
| // command under test. test_auth.bats, for example, uses `solr assert` to wait for startup, so | ||
| // it cannot join until the assert command is migrated. test_help.bats asserts the exact wording | ||
| // of the commons-cli help output, which the picocli implementation words differently. | ||
| // TODO: Remove these explicit files entry from here after fixing 4 remaining bats file | ||
| testFiles = [ | ||
| 'test/test_adminconsole_urls.bats', | ||
| 'test/test_assert.bats', | ||
| 'test/test_bats.bats', | ||
| 'test/test_compression.bats', | ||
| 'test/test_config.bats', | ||
| 'test/test_create_collection.bats', | ||
| 'test/test_example.bats', | ||
| 'test/test_export.bats', | ||
| 'test/test_opennlp.bats', | ||
| 'test/test_placement_plugin.bats', | ||
| 'test/test_rolling_upgrade.bats', | ||
| 'test/test_snapshots.bats', | ||
| 'test/test_ssl.bats', | ||
| 'test/test_start_solr.bats', | ||
| 'test/test_zz_cleanup.bats', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this means we now run the entire BATS suite for picocli, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are running 26/30 bats suite for now, the 4 that are not in the list: tests_basic_auth, test_help, test_post & test_stream. I will work on debugging & fixing in a quick follow-up PR & then those will also get added. we will then remove this Todo & then we can say all 30 BATs suite runs for PicoCLI.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| 'test/test_version.bats', | ||
| 'test/test_status.bats', | ||
| 'test/test_create.bats', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| = Experimental picocli Command Line Interface | ||
| = Command Line Interface | ||
| :page-toclevels: 2 | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
|
|
@@ -17,42 +17,34 @@ | |
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| Solr is migrating the `bin/solr` command line tool from Apache Commons CLI to https://picocli.info/[picocli]. | ||
| While that work is in progress, both implementations ship together and the picocli one can be enabled on request. | ||
| The `bin/solr` command line tool is built on https://picocli.info/[picocli]. | ||
| This page and the per-command pages linked below are the references for its commands and options. | ||
| Run `bin/solr <command> --help` for the same information on the command line. | ||
|
|
||
| [WARNING] | ||
| ==== | ||
| The picocli command line interface is *experimental* and disabled by default. | ||
| == Falling back to the legacy CLI | ||
|
|
||
| * Only some commands have been migrated so far. | ||
| * Options, defaults and error messages may change without notice between releases. | ||
| * Where this implementation and the default one differ, xref:solr-control-script-reference.adoc[] describes what `bin/solr` actually does by default. | ||
| The previous Apache Commons CLI implementation still ships with Solr. | ||
| Use it only as an escape hatch if you run into a problem with the default CLI, and please report the problem to the Solr project. | ||
| Its options and output differ in places; see xref:solr-control-script-reference.adoc[] for its documentation. | ||
|
|
||
| Do not depend on it in scripts or automation yet. | ||
| ==== | ||
|
|
||
| == Enabling It | ||
|
|
||
| Set `SOLR_PICOCLI` in your `solr.in.sh` (or `solr.in.cmd` on Windows): | ||
| To switch, set `SOLR_PICOCLI` in your `solr.in.sh` (or `solr.in.cmd` on Windows): | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| SOLR_PICOCLI=true | ||
| SOLR_PICOCLI=false | ||
| ---- | ||
|
|
||
| Or set the equivalent system property for a single invocation: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| SOLR_TOOL_OPTS="-Dsolr.picocli=true" bin/solr status | ||
| SOLR_TOOL_OPTS="-Dsolr.picocli=false" bin/solr status | ||
| ---- | ||
|
|
||
| Unset it, or set it to anything other than `true`, to return to the default implementation. | ||
|
|
||
| == Migrated Commands | ||
| == Commands | ||
|
|
||
| The commands below have been migrated and have a reference page generated from their source annotations. | ||
| Any command not listed here is unavailable when the picocli implementation is enabled, and reports an unmatched argument. | ||
| Each command has a reference page generated from its source annotations. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An end user won't know what a "source annotation" is. The ref guide is for end users, we should describe what they see, the commands they write and the response they get back, not code-level things. |
||
|
|
||
| // CLI-DOCS-TABLE-START | ||
| [cols="1",options="header"] | ||
|
|
@@ -103,18 +95,18 @@ Any command not listed here is unavailable when the picocli implementation is en | |
| |=== | ||
| // CLI-DOCS-TABLE-END | ||
|
|
||
| == Known Limitations | ||
| == Migration Changes | ||
|
|
||
| In addition to the commands that have not been migrated yet: | ||
| These are the changes in default CLI behavior as compared to 9.x and 10.1. | ||
|
|
||
| * On a sub-command, `-v` means `--verbose`; only the top-level `bin/solr` accepts `-v` as a request for the version. | ||
| * `bin/solr config` has no `-v` short form for `--value`, because `-v` means `--verbose`; use `--value`. | ||
| The default implementation accepts `-v` for it. | ||
| The legacy CLI accepts `-v` for it. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's dangerous to use a term like legacy, in this context we could perhaps say that before Solr 10.2 The legacy comment is general for any other place it may have been used. Also, I'm not sure that "migration changes" even belong in this doc page. It will duplicate the upgrade notes in major-changes-in-solr-10, section 10.2. so I'd prefer if we just do a WARNING callout on this page with a link to that upgrade notes section, and document all deliberate breaking changes for PicoCLI there only. |
||
| * `--fail-on-exists` on `bin/solr zk mkroot` treats the option as set whenever it is present, whatever value follows it. | ||
| This matches the default implementation, but means `--fail-on-exists false` does not disable the check. | ||
| * Error messages for invalid or mutually exclusive options are worded differently from the default implementation. | ||
| This matches the legacy CLI, but means `--fail-on-exists false` does not disable the check. | ||
| * Error messages for invalid or mutually exclusive options are worded differently from the legacy CLI. | ||
| * Usage and help output is laid out differently throughout, so anything parsing the output of `--help` will need adjusting. | ||
| * Typing a `zk` sub-command without the `zk` prefix, for example `bin/solr ls`, reports an unmatched argument rather than the reminder the default implementation prints. | ||
| * Typing a `zk` sub-command without the `zk` prefix, for example `bin/solr ls`, reports an unmatched argument rather than the reminder the legacy CLI prints. | ||
| That syntax was removed in Solr 9; use `bin/solr zk ls`. | ||
|
|
||
| == Reporting Problems | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.