Skip to content

Comments

Fix broken CLI caused by double-parse bug#428

Open
dom-nie wants to merge 1 commit intoCommit-Boost:mainfrom
dom-nie:fix/cli-double-parse-bug
Open

Fix broken CLI caused by double-parse bug#428
dom-nie wants to merge 1 commit intoCommit-Boost:mainfrom
dom-nie:fix/cli-double-parse-bug

Conversation

@dom-nie
Copy link

@dom-nie dom-nie commented Feb 17, 2026

Summary

PR #408 added an empty Cli struct with Cli::parse() before the real Args::parse() in all three binaries (cli, pbs, signer). Since Cli has no fields or subcommands, clap treats it as a complete parser — --help renders without subcommands and any argument like init is rejected as unexpected. The real Args::parse() is never reached.

This PR:

  • Moves the VERSION constant (with "v" prefix) into the shared cb_cli crate
  • Removes the empty Cli structs from bin/cli.rs, bin/pbs.rs, and bin/signer.rs
  • Adds regression tests for subcommand parsing and version prefix

Fixes #375

Bug reproduction (on main)

$ commit-boost-cli --help
Usage: commit-boost-cli

Options:
  -h, --help     Print help
  -V, --version  Print version

$ commit-boost-cli init --config test.toml
error: unexpected argument 'init' found

After fix

$ commit-boost-cli --version
commit-boost-cli v0.9.3

$ commit-boost-cli --help
Usage: commit-boost-cli <COMMAND>

Commands:
  init  Generate the starting docker-compose file
  help  Print this message or the help of the given subcommand(s)

Test plan

  • cargo check passes
  • cargo test -p cb-cli passes (2 new tests)
  • commit-boost-cli --version shows version with "v" prefix
  • commit-boost-cli --help lists init subcommand
  • commit-boost-cli init --config <path> works
  • commit-boost-pbs --version and commit-boost-signer --version work

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support for the --version argument

1 participant