diff --git a/Cargo.deps.newer b/Cargo.deps.newer index 8dfae554..197dfa3e 100644 --- a/Cargo.deps.newer +++ b/Cargo.deps.newer @@ -2,7 +2,7 @@ # For the newer-than-Byzantium config bitflags = "1.3.*" -clap = { version = "3.2.*", features=["std"], default-features = false } +clap = { version = "4.*", features=["std"], default-features = false } zbus = "1.9.*" zvariant = "2.10.*" # Newer versions seem to confuse the version of Cargo on Debian Bullseye diff --git a/Cargo.toml.in b/Cargo.toml.in index f246d1c4..c9b20647 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -24,6 +24,7 @@ path = "@path@/examples/find_orphan_layouts.rs" [features] glib_v0_14 = [] zbus_v1_5 = [] +clap_v4 = [] # Dependencies which don't change based on build flags [dependencies] diff --git a/meson.build b/meson.build index a3eeb947..87e2d0e2 100644 --- a/meson.build +++ b/meson.build @@ -99,7 +99,7 @@ cargo_toml_base = configure_file( cargo_patch = [] if get_option('newer') == true - cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5'] + cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5,clap_v4'] cargo_deps = files('Cargo.deps.newer') cargo_lock = files('Cargo.lock.newer') else diff --git a/src/bin/test_layout.rs b/src/bin/test_layout.rs index a5722809..090d063e 100644 --- a/src/bin/test_layout.rs +++ b/src/bin/test_layout.rs @@ -5,12 +5,28 @@ extern crate rs; use rs::tests::check_layout_file; fn main() -> () { + #[cfg(feature = "clap_v4")] + let matches = clap::Command::new("squeekboard-test-layout") + .about("Test keyboard layout for errors. Returns OK or an error message containing further information.") + .arg( + clap::Arg::new("INPUT") + .required(true) + .help("Yaml keyboard layout file to test") + ) + .get_matches(); + #[cfg(feature = "clap_v4")] + let m = matches.get_one::("INPUT"); + + #[cfg(not(feature = "clap_v4"))] 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()) == () { + #[cfg(not(feature = "clap_v4"))] + let m = matches.value_of("INPUT"); + + if check_layout_file(m.unwrap()) == () { println!("Test result: OK"); } }