Jan Høydahl created SOLR-18517:
----------------------------------
Summary: Port RunExampleTool to PicoCli
Key: SOLR-18517
URL: https://issues.apache.org/jira/browse/SOLR-18517
Project: Solr
Issue Type: Improvement
Components: cli
Reporter: Jan Høydahl
Port {{RunExampleTool}} to picocli, adding the picocli code path alongside the
existing commons-cli one.
*Covers:* {{bin/solr start \-\-example}} / {{\-e}} (the internal
{{run_example}} tool)
Unlike the other tools this is not a user-facing top-level command:
{{bin/solr}} intercepts {{\-e}} / {{\-\-example}} on {{start}} and shells out
to {{run_tool run_example ...}}, which invokes {{SolrCLI}} with {{run_example}}
as the first argument. Options are {{\-e}} / {{\-\-example}},
{{\-\-example-dir}}, {{\-\-server-dir}}, {{\-\-solr-home}}, {{\-\-port}},
{{\-\-host}}, {{\-\-url-scheme}}, {{\-\-memory}}, {{\-\-jvm-opts}},
{{\-\-user-managed}}, {{\-\-force}}, {{\-\-no-prompt}}, {{\-\-script}} and
{{\-\-script-inputs}}.
This issue is what unblocks examples on the picocli path. {{run_example}} is
not in {{SolrCLI}}'s picocli {{subcommands}} list, so with
{{SOLR_PICOCLI=true}} today {{bin/solr start \-e cloud}} cannot resolve the
sub-command — which is why {{test_example.bats}} is absent from the
{{integrationTestsPicocli}} list. Decide as part of this issue whether
{{run_example}} stays a hidden sub-command or whether {{\-\-example}} moves
onto the already-ported {{StartCommand}}.
Note that {{\-\-prompt-inputs}} was renamed to {{\-\-script-inputs}} by
SOLR-18468; port the current spelling.
*Acceptance criteria*
* {{bin/solr start \-e <example>}} works with {{SOLR_PICOCLI=true}}, and the
commons-cli path is left behaviourally unchanged.
* {{ToolBase.callTool()}} is implemented, replacing the
{{UnsupportedOperationException}} stub, and the command is reachable under
picocli by whichever route is chosen above.
* A {{RunExampleToolPicocliTest}} subclasses the existing test and overrides
only the {{runTool}} hook, so the inherited assertions run through both parsers.
* {{test_example.bats}} is added to the {{integrationTestsPicocli}} list in
{{solr/packaging/build.gradle}} once every command it invokes has been ported.
* {{./gradlew :solr:solr-ref-guide:generateCliDocs}} is re-run and any affected
CLI page committed, so {{checkCliDocsUpToDate}} passes.
*AI assistance:* a coding-agent prompt template encoding the patterns already
established by the ported tools is available at
[https://gist.github.com/janhoy/a3fe0dbcaadf24b3493558946cc549d9] — name
{{RunExampleTool}} in its Assignment line up front and the rest of the prompt
adapts. Please review agent output as carefully as hand-written code.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]