Crate klask

Source
Expand description

You can use run_app for Apps created manually or generated from yaml and run_derived for Apps derived from a struct. Both of these functions take a closure that contains the code that would normally be in main. They should be the last thing you call in main.

For example

fn main() {
    let app = App::new("Example").arg(Arg::new("debug").short('d'));
    klask::run_app(app, Settings::default(), |matches| {
       println!("{}", matches.is_present("debug"))
    });
}

corresponds to

fn main() {
    let app = App::new("Example").arg(Arg::new("debug").short('d'));
    let matches = app.get_matches();
    println!("{}", matches.is_present("debug"))
}

Modules§

  • Additional options for output like progress bars.

Structs§

Functions§

  • Call with an App and a closure that contains the code that would normally be in main.
  • Can be used with a struct deriving [clap::Clap]. Call with a closure that contains the code that would normally be in main. It’s just a wrapper over run_app.