facet-args

Crates.iofacet-args
lib.rsfacet-args
version0.28.0
created_at2025-04-10 03:39:14.09265+00
updated_at2025-07-25 12:47:19.278323+00
descriptionCommand-line argument parsing for the facet ecosystem
homepage
repositoryhttps://github.com/facet-rs/facet-args
max_upload_size
id1627609
size201,489
Amos Wenger (fasterthanlime)

documentation

https://docs.rs/facet-args

README

Facet logo - a reflection library for Rust

Coverage Status crates.io documentation MIT/Apache-2.0 licensed Discord

Logo by Misiasart

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon Zed Depot

Provides CLI argument parsing (WIP).

use facet_pretty::FacetPretty;
use facet::Facet;

#[derive(Facet)]
struct Args {
    #[facet(positional)]
    path: String,

    #[facet(named, short = 'v')]
    verbose: bool,

    #[facet(named, short = 'j')]
    concurrency: usize,
}

# fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Args = facet_args::from_slice(&["--verbose", "-j", "14", "example.rs"])?;
eprintln!("args: {}", args.pretty());
Ok(())
# }

License

Licensed under either of:

at your option.

Commit count: 0

cargo fmt