Skip to content

Commit d9b8f7b

Browse files
committed
Improve the examples
1 parent a3c16f9 commit d9b8f7b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
File renamed without changes.

examples/cli.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
extern crate lit;
2+
extern crate clap;
3+
4+
use clap::{App, Arg};
5+
use std::env::consts;
6+
7+
fn main() {
8+
let app = App::new("Example of a testing tool CLI frontend")
9+
.version(env!("CARGO_PKG_VERSION"))
10+
.author(env!("CARGO_PKG_AUTHORS"))
11+
.about(env!("CARGO_PKG_DESCRIPTION"))
12+
.arg(Arg::with_name("v")
13+
.short("v")
14+
.multiple(true)
15+
.help("Sets the level of verbosity"));
16+
17+
let app = lit::config::clap::mount_inside_app(app, true);
18+
19+
let matches = app.get_matches();
20+
21+
println!("Verbose: {}", matches.is_present("v"));
22+
23+
lit::run::tests(lit::event_handler::Default::default(), |config| {
24+
config.add_search_path("integration-tests/");
25+
config.add_extension("txt");
26+
27+
config.constants.insert("arch".to_owned(), consts::ARCH.to_owned());
28+
config.constants.insert("os".to_owned(), consts::OS.to_owned());
29+
30+
lit::config::clap::parse_arguments(&matches, config);
31+
}).unwrap()
32+
}

0 commit comments

Comments
 (0)