Expand description
You can use run_app
for App
s created manually or generated from yaml and
run_derived
for App
s 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§
- output
- Additional options for output like progress bars.
Structs§
- Settings
- Settings for klask.
Functions§
- run_app
- Call with an
App
and a closure that contains the code that would normally be inmain
. - run_
derived - Can be used with a struct deriving [
clap::Clap
]. Call with a closure that contains the code that would normally be inmain
. It’s just a wrapper overrun_app
.