clap_main

Crates.ioclap_main
lib.rsclap_main
version0.2.9
sourcesrc
created_at2023-10-19 21:08:47.713676
updated_at2024-02-15 22:49:17.185094
descriptionA crate to provide a #[clap_main] macro to automatically parse and pass args to your main function
homepage
repositoryhttps://git.casuallyblue.dev/sierra/clap_main
max_upload_size
id1008387
size9,625
(casuallyblue)

documentation

README

Clap Main

This crate provides an procmacro #[clap_main] to decorate your entry point function and automatically parse a struct that implements clap::Parser from the cli args.

Example Usage

Requires clap with the derive feature enabled


#[derive(clap::Parser)]
struct CliArgs {
  /// A name to be greeted
  name: String
}

#[clap_main::clap_main]
fn main(CliArgs { name }: CliArgs) {
  println!("Hello {name}");  
}
Commit count: 0

cargo fmt