diff --git a/Cargo.toml b/Cargo.toml index b7fbd203..44e02b37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" [dependencies] bitflags = "1.0.*" +clap = "2.32.*" maplit = "1.0.*" regex = "1.1.*" serde = { version = "1.0.*", features = ["derive"] } diff --git a/debian/control b/debian/control index f1031040..eba8e260 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,7 @@ Build-Depends: libgtk-3-dev, libcroco3-dev, librust-bitflags-1-dev (>= 1.0), + librust-clap-2+default-dev (>= 2.32), librust-gio+v2-44-dev, librust-glib+v2-44-dev, librust-glib-sys-dev, diff --git a/src/bin/test_layout.rs b/src/bin/test_layout.rs index 3ec5f366..a5722809 100644 --- a/src/bin/test_layout.rs +++ b/src/bin/test_layout.rs @@ -1,8 +1,16 @@ +#[macro_use] +extern crate clap; extern crate rs; use rs::tests::check_layout_file; -use std::env; fn main() -> () { - check_layout_file(env::args().nth(1).expect("No argument given").as_str()); + let matches = clap_app!(test_layout => + (name: "squeekboard-test-layout") + (about: "Test keyboard layout for errors. Returns OK or an error message containing further information.") + (@arg INPUT: +required "Yaml keyboard layout file to test") + ).get_matches(); + if check_layout_file(matches.value_of("INPUT").unwrap()) == () { + println!("Test result: OK"); + } }