Repository navigation
Conversation
Keep the CLI README's flag-placement and parse-error section alongside the new structured extraction section.
Keep both Unreleased fixes: the CLI parse-error entry for Tencent#387 and the DSH tool-registration entry for Tencent#444.
Keep the global output flag parse test next to main's renamed background session test.
The focus mapping cases from Tencent#447 still looked up browser_session after Tencent#446 renamed the tool, so they failed on main as well.
Keep upstream's explicit bsk_session registration check and move the issue Tencent#387 changelog entry back under Unreleased after 0.3.3.
This branch has not been deployed
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.
With
--json, a command-line parsing failure currently prints clap's usage error to stderr and leaves stdout empty, so a caller reading the JSON contract sees no error at all. The case from the issue,--sessiongiven before the subcommand, is also misreported: clap suggests--versionand printsUsage: bsk --version <COMMAND>.Fixes #387.
--jsonappears in argv before--, clap failures are written to stdout as the usual flat error:code: "invalid_params",exit_code: 1,data.reason: "cli_parse_error".messageis clap's summary on one line;data.detailskeeps the full clap text with tips and usage. The flag is read from raw argv because clap can stop before it reaches--json; a--jsoninside a value (--selector=--json) or after--does not count.--session/--tab-idgets a rebuilt clap error: the tip says the option belongs after a supporting subcommand, and the usage line is that of the command being parsed instead of one built around--version. The same text is the JSONhint.--help/--versionprint text and exit 0 even with--json.--sessionand--tab-idare not made global, which the issue suggests first. Most commands require them and some do not accept them. A clap global argument cannot be required and would collide with each command's own--session, so commands would lose clap's per-command validation and help, and commands such asstatuswould silently accept a session.--json,--quietand--verbosewere already global; a parse test now covers both placements.Testing
cargo test -p bsk --test cli_usage_errors --test cli_parse --locked: process-level coverage of stdout/stderr separation, exit codes, redirected stdout, non-UTF-8 argv, forced color, nested subcommands, and the--/--flag=--jsoncasescargo test -p bsk --lockedcargo fmt --all -- --check,cargo clippy -p bsk --all-targets --locked -- -D warnings