Migrate CLI parsing from clap to usage-rs - #145
Open
edmundmiller wants to merge 2 commits into
Open
Conversation
Replace clap derive parsing with usage-rs 6.1.1 so rustqc keeps the same flags, shorts, env vars, and defaults while gaining a portable usage spec for completions, manpages, and docs. Co-authored-by: Edmund Miller <edmundmiller@users.noreply.github.com>
edmundmiller
marked this pull request as ready for review
August 23, 2026 16:42
usage-rs 6.1.1 requires rustc 1.91. Bump rust-version and the CI MSRV job to match. Update crossbeam-epoch to 0.9.20 for RUSTSEC-2026-0204. Co-authored-by: Edmund Miller <edmundmiller@users.noreply.github.com>
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.
Replace clap with usage-rs 6.1.1 for
rustqcargument parsing, following the clap migration guide. QC algorithms and the BAM pass are unchanged.What changed
usage = { package = "usage-rs", version = "6.1.1", features = ["completions"] }instead of clap 4.#[derive(Parser)]/#[derive(Subcommand)]become#[derive(usage::Cli)]/#[derive(usage::Subcommands)]/#[derive(usage::Args)].Strandednessnow derivesusage::ValueEnum(stillserde::Deserialize+Display). Library consumers that treated it as clap’sValueEnumneed to switch; parsing via serde YAML is unchanged.--versionstill prints crate version, git hash, build timestamp, and the runtime CPU info line.-Vstays short.__usage_spec__(portable KDL) and__complete_word__(runtime completions).AGENTS.md/CONTRIBUTING.mdno longer claim clap.crossbeam-epochupdated to 0.9.20 for RUSTSEC-2026-0204.cargo tree -i clapreports no clap crate in the app graph.Intentional flag / help diffs
User-facing flags, shorts, env vars, defaults, and requiredness are the same. Parse errors and
--help/--versionstill exit 2 / 0.Help text is now rendered by usage, not clap’s custom
help_template:rustqc rna <FLAGS> <INPUT>…rather than clap’s[OPTIONS] <INPUT>....helpsubcommand (clap did this too by default).unknown_flags = "error"); repeated scalar flags are rejected (args_override_self = false).--thr→--threads). Full names or declared aliases only.Regenerating completions / docs
usage-rs is experimental; pin producers and consumers to 6.1.1.
Shell completion scripts can also be produced in-process with
Cli::completion_script(usage::complete::Shell::…).Verification
cargo +stable fmt --checkandcargo +stable clippy -- -D warningspass.cargo +stable test: 200 lib unit tests, 15 binary CLI tests, and 18 integration tests passed.rustqc --help,-h,--version,-V,rna --help, missing--gtf(exit 2), and unknown flags (exit 2).crossbeam-epoch); both are addressed in the follow-up commit.