Registry / cli / clap-derive

clap-derive

JSON →
library4.6.1rscratesunverified

Derive macro for parsing command line arguments using struct definitions.

# Cargo.toml [dependencies] clap_derive = "4.6.1"
INSTALL
IMPORT
SIG · CLAP-DERIVE
C
clap-derive
clirustv4.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Parser
use clap::Parser;

Defines a CLI argument struct and parses it.

use clap::Parser; #[derive(Parser)] #[command(name = "myapp")] struct Args { #[arg(short, long)] name: String, } fn main() { let args = Args::parse(); println!("Hello, {}!", args.name); }
Debug
Known issues
gotchaThe `derive` feature must be enabled for clap
fix
Add `clap = { version = "4", features = ["derive"] }` to Cargo.toml
affects: >=4.0.0
Upgrade
Version history
4.6.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
Resources
clap-derive — cargo add clap-derive · libregistry