ITADN

Migrate cargo-detect-package and cargo-freeze-deps from argh to clap

#252Closedsandersaares 创建于 2026-06-22
S
sandersaarescommented
## Summary Migrate the remaining cargo subcommands — `cargo-detect-package` and `cargo-freeze-deps` — from `argh` to `clap`, matching the migration of `cargo-bench-history`. ## Background `cargo-bench-history` is moving from `argh` to `clap` so its (large) CLI surface can present **grouped, named argument sections** in `--help`. `argh` has no support for help-section grouping (its only field attributes are `option`/`switch`/`positional`/`subcommand`/`greedy`/`long`/`short`/`default`/`arg_name`/`description`), whereas clap supports it via `#[arg(help_heading = "…")]`. For workspace consistency, the two remaining argh-based cargo tools should adopt clap as well. Their CLIs are trivial (`cargo-detect-package` has ~4 arguments, `cargo-freeze-deps` ~2), so this is a mechanical conversion. ## Scope - `packages/cargo-detect-package/src/main.rs` — convert the `FromArgs` derive to clap `Parser`. - `packages/cargo-freeze-deps/src/main.rs` — same. - Remove the `argh` dependency from these two packages (and from `[workspace.dependencies]` if no remaining consumer; run the cargo-deps-tidy skill afterwards). - Keep behaviour and help text equivalent; add `help_heading` grouping only if a tool grows enough arguments to warrant it. - Update each package's tests for the clap-shaped help/error output. ## Out of scope - `cargo-bench-history` (migrated in the originating PR). ## Notes The workspace already pulls in clap transitively (via criterion). Per the dependency conventions, declare it with `default-features = false` at the workspace level and re-enable `clap/default` (CLI parsing libraries are the documented exception to the no-default-features rule).
关闭于 2026-06-24 0 条评论