Fix broken CLI caused by double-parse bug#428
Open
dom-nie wants to merge 1 commit intoCommit-Boost:mainfrom
Open
Fix broken CLI caused by double-parse bug#428dom-nie wants to merge 1 commit intoCommit-Boost:mainfrom
dom-nie wants to merge 1 commit intoCommit-Boost:mainfrom
Conversation
The empty `Cli` struct added in PR Commit-Boost#408 intercepts all argument parsing before the real `Args` struct is reached, making all subcommands and `--help` non-functional. Move the custom VERSION constant (with "v" prefix) into the shared `cb_cli` crate and remove the empty `Cli` structs from all three binaries (cli, pbs, signer). Fixes Commit-Boost#375
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.
Summary
PR #408 added an empty
Clistruct withCli::parse()before the realArgs::parse()in all three binaries (cli,pbs,signer). SinceClihas no fields or subcommands, clap treats it as a complete parser —--helprenders without subcommands and any argument likeinitis rejected as unexpected. The realArgs::parse()is never reached.This PR:
VERSIONconstant (with "v" prefix) into the sharedcb_clicrateClistructs frombin/cli.rs,bin/pbs.rs, andbin/signer.rsFixes #375
Bug reproduction (on
main)After fix
Test plan
cargo checkpassescargo test -p cb-clipasses (2 new tests)commit-boost-cli --versionshows version with "v" prefixcommit-boost-cli --helplistsinitsubcommandcommit-boost-cli init --config <path>workscommit-boost-pbs --versionandcommit-boost-signer --versionwork