Skip to content

SOLR-18516: Port PostTool and PostLogsTool to picocli - #5042

Open
serhiy-bzhezytskyy wants to merge 4 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18516-picocli-post
Open

serhiy-bzhezytskyy wants to merge 4 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18516-picocli-post

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18516

Description

Adds the picocli code path for bin/solr post and bin/solr postlogs, next to the commons-cli one. test_postlogs.bats and test_extraction.bats could not join the picocli suite until now.

Solution

PostTool and PostLogsTool get their annotated options and callTool() and are registered in SolrCLI; the commons-cli path is unchanged. Written with Claude Code.

Tests

PostToolPicocliTest runs the existing PostToolTest through picocli; its --params value no longer carries literal quotes, which commons-cli strips and picocli keeps. PostLogsToolCliTest and PostLogsToolPicocliTest post a small log through both parsers. test_postlogs.bats now says --rootdir, as picocli does not take -rootdir. Both BATS files pass under both parsers and are added to integrationTestsPicocli; check -x test is clean (rat skipped).

Checklist

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

Adds the picocli code path next to the commons-cli one for both commands, with test twins, the generated reference pages and test_postlogs.bats and test_extraction.bats in the picocli suite.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tool:build tests cat:cli labels Oct 6, 2026
The reference guide calls it the Post command, so the generated page now opens with the same words.

@janhoy janhoy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the general changelog comment and a few nits, LGTM

assert_output --partial "Created collection 'COLL_NAME'"

run solr postlogs --solr-url http://localhost:${SOLR_PORT} -c COLL_NAME -rootdir ${SOLR_LOGS_DIR}/solr.log
run solr postlogs --solr-url http://localhost:${SOLR_PORT} -c COLL_NAME --rootdir ${SOLR_LOGS_DIR}/solr.log

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the ref guide only spells it --rootdir

" bin/solr post -c gettingstarted *.json",
"",
" # Index a tab-separated file, using the CSV handler's separator param",
" bin/solr post -c gettingstarted --params \"separator=%%09\" --type text/csv data.tsv",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify the generated solr-post.adoc shows %09, not %%09.

No picocli feature has been released yet, so a new command is a detail of the SOLR-17697 entry. Its author and JIRA are added there instead of a separate entry.
The Ref Guide listed it as -rootdir, which commons-cli accepts but picocli does not; --rootdir works with both parsers and is what the example and the generated page use.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Both checked: the generated solr-post.adoc shows %09 (not %%09), and the Ref Guide now spells the option --rootdir (c77ed81).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:cli documentation Improvements or additions to documentation tests tool:build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants