Repository navigation
Parse the correlator's command line with picocli - #8
Merged
Merged
Conversation
The correlator's options were parsed by hand: one stale usage string for every command, the same "Unknown, duplicate or missing option" error thrown as a stack trace for any mistake, and a special case for each repeatable option. It is about to grow by some thirty options and two subcommands, so every command is now a picocli command. - The top-level command still correlates with the same options, and `correlate` names it explicitly. `stacks`, `merge`, `export` and `dump` are subcommands; `--dump --source FILE` is kept as a deprecated alias of `dump --source FILE`. `help <command>` and `<command> --help` print the command's options with their defaults, and `--version` the build and the pinned async-profiler fork commit. - Option names, values, defaults and meanings are unchanged. Enumerated values are converted by type and an invalid one lists the valid values; comma-separated and repeatable options keep their forms and order. - Behaviour change: an invalid command line returns 64 (EX_USAGE) with the message, a "did you mean" suggestion for a mistyped option and the command's usage on stderr, instead of throwing IllegalArgumentException out of run(). picocli's default of 2 would collide with "narrowed or partial". run() still returns the exit code and never calls System.exit, and a failure of the analysis itself still throws. - picocli 4.7.7 is embedded with a pinned digest and relocated under the correlator's internal package, like the other bundled dependencies. CommandLineTest checks each command's help against a snapshot in src/test/resources/help, usage errors (exit 64, usage shown, no stack trace), that dump and --dump agree, and that every option the README's correlate, slicing and "Correlator options" sections name exists in the parser with the default the table states. On the Pulsar broker fixture profile, stacks and export write byte-identical files to the published pre-picocli 0.5.0-SNAPSHOT.
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of the 0.5.0 correlator stack (spec:
cli-picocli.md). Moves every correlator command to picocli, so the later PRs can add the transform,top,summarizeand export options as typed picocli options.Stack: #8 (this) ← #10 stack transforms ← #11 SQL-friendly export ← #12 top/summarize ← #13 README. Independent: #9 (population estimate); its
--max-accounted-lossneeds porting to picocli when both land — a verified resolution is on branchpopulation-estimate-on-picocli.What changes
correlatenames it explicitly.stacks,merge,export,dumpare subcommands;--dump --source FILEstays as a deprecated alias.help <command>/<command> --helpshow each command's options and defaults;--versionprints the build and the pinned async-profiler fork commit.IllegalArgumentExceptionout ofrun(). picocli's default of 2 would collide with "narrowed/partial".run()still never callsSystem.exit, and analysis failures still throw.io.github.lhotari.jonoffcpu.correlator.internal.shaded.picocli.required, because picocli reports a missing required option ahead of an unknown one, which would hide a typo such asstacks --stakc.Verification
./gradlew spotlessCheck :jonoffcpu-correlator:checkpasses.CommandLineTest: help snapshots per command (src/test/resources/help/*.txt), usage errors (64, usage shown, no stack trace),dumpand--dumpgive identical output,runreturns control on a failing correlation, and the README's option names and stated defaults are checked against the parser.stacks(default, launcher-style--package-names drop --summary --exclude-from,--stack java+kernel --reason blocked) andexport(csv, jsonl) write files byte-identical to the published pre-picocli 0.5.0-SNAPSHOT JAR.picocli/classes, andjava -jarworks on its own.