Jan Høydahl created SOLR-18515:
----------------------------------

             Summary: Port PackageTool to PicoCli
                 Key: SOLR-18515
                 URL: https://issues.apache.org/jira/browse/SOLR-18515
             Project: Solr
          Issue Type: Improvement
          Components: cli
            Reporter: Jan Høydahl


Port {{PackageTool}} to picocli, adding the picocli code path alongside the 
existing commons-cli one.

*Covers:* {{bin/solr package}} and its ten sub-commands

This is the largest remaining tool, the only one with a real sub-command tree, 
and the only one that was not given a {{*Params}} record by SOLR-18443 — so it 
needs that extraction as well as the port. The sub-commands are currently 
dispatched by a {{switch}} on the first positional argument:

* {{add-repo <repository-name> <repository-url>}}
* {{add-key <file-containing-trusted-key>}}
* {{install <package-name>[:<version>]}}
* {{deploy <package-name>[:<version>] [-y] [--update] --collections 
<collections> [-p <key>=<value> ...]}}
* {{undeploy <package-name> --collections <collections>}}
* {{uninstall <package-name>:<version>}}
* {{list-installed}}
* {{list-available}}
* {{list-deployed -c <collection>}}
* {{list-deployed <package-name>}}

The point of the port is to replace that positional {{switch}} with real 
picocli sub-commands, each with its own parameters and generated help, 
following the pattern {{ZkTool}} established for the {{zk}} group.

Work is already in flight in [PR 
#4739|https://github.com/apache/solr/pull/4739]; that PR should be rebased onto 
main now that SOLR-17697 has landed, and re-targeted at this issue.

*Acceptance criteria*
* {{bin/solr package}} and every sub-command work with {{SOLR_PICOCLI=true}}, 
and the commons-cli path is left behaviourally unchanged.
* The business logic is made parser-independent (a {{*Params}} record or 
equivalent), as the other tools already are.
* Each sub-command is a real picocli sub-command with its own parameters and 
generated help, rather than a positional {{switch}}.
* {{PackageTool}} is registered in {{SolrCLI}}'s picocli {{subcommands}} list 
and {{ToolBase.callTool()}} is implemented, replacing the 
{{UnsupportedOperationException}} stub.
* A {{PackageToolPicocliTest}} subclasses the existing test and overrides only 
the {{runTool}} hook, so the inherited assertions run through both parsers.
* {{./gradlew :solr:solr-ref-guide:generateCliDocs}} is re-run and the 
generated CLI pages are committed, so {{checkCliDocsUpToDate}} passes.

Note: this issue is deliberately *not* labelled {{newdev}} — the sub-command 
tree and the missing logic extraction make it a poor first task.

*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 
{{PackageTool}} 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]

Reply via email to