fix(cli2): handle --help and --version flags properly #1897
+18
−0
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.
Summary
Fixes
--helpand--versionCLI flags not working in the desktop app.Root cause: The
tauri-plugin-cliconverts clap'sDisplayHelpandDisplayVersionerrors intoOk(Matches)with "help" and "version" keys inmatches.args. The existingentrypointfunction only checked for subcommands and ignored these special keys, so--help/--versionwould silently do nothing.Fix: Added handling at the start of
entrypoint()to check for these keys, print the appropriate output, and exit cleanly.Verified on Linux
Release build tested successfully:
Review & Testing Checklist for Human
{name} {version}) is acceptable - could be changed to just{version}if preferredhyprnote bug,hyprnote web,hyprnote changelogtauri-plugin-importeraddition - verify this is expected or revert if notNotes
std::process::exit(0)which is standard for CLI help/version handlinghandle_cli_matchesfunction inext.rsthat attempted similar logic but was never called - could be cleaned up in a follow-upLink to Devin run: https://app.devin.ai/sessions/55712bc7389c4dc6b78c0dded19003c0
Requested by: yujonglee (@yujonglee)