diff --git a/Cargo.lock b/Cargo.lock index e79594bd..1eab657e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] @@ -45,9 +45,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.61" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" +checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" dependencies = [ "addr2line", "cc", @@ -84,9 +84,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406" +checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63" dependencies = [ "atty", "bitflags", @@ -97,14 +97,14 @@ dependencies = [ "strsim", "termcolor", "textwrap", - "vec_map", + "unicase", ] [[package]] name = "clap_derive" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac" +checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3" dependencies = [ "heck", "proc-macro-error", @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +checksum = "81a03ce013ffccead76c11a15751231f777d9295b845cc1266ed4d34fcbd7977" [[package]] name = "hashbrown" @@ -451,9 +451,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716d3d89f35ac6a34fd0eed635395f4c3b76fa889338a4632e5231a8684216bd" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", ] @@ -562,9 +562,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.103" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" +checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" [[package]] name = "linked-hash-map" @@ -748,9 +748,9 @@ dependencies = [ [[package]] name = "object" -version = "0.26.2" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2" +checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" dependencies = [ "memchr", ] @@ -763,9 +763,12 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "os_str_bytes" -version = "3.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d" +checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799" +dependencies = [ + "memchr", +] [[package]] name = "owo-colors" @@ -831,9 +834,9 @@ checksum = "36d62894f5590e88d99d0d82918742ba8e5bff1985af15d4906b6a65f635adb2" [[package]] name = "ppv-lite86" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" +checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" [[package]] name = "proc-macro-error" @@ -1336,6 +1339,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -1354,12 +1366,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.3" diff --git a/komorebi-core/Cargo.toml b/komorebi-core/Cargo.toml index 779b049f..3d8f433a 100644 --- a/komorebi-core/Cargo.toml +++ b/komorebi-core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = "3.0.0-beta.4" +clap = "3.0.0-beta.5" color-eyre = "0.5" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/komorebi/Cargo.toml b/komorebi/Cargo.toml index 62c2bb02..e66daaea 100644 --- a/komorebi/Cargo.toml +++ b/komorebi/Cargo.toml @@ -14,7 +14,7 @@ edition = "2021" komorebi-core = { path = "../komorebi-core" } bitflags = "1" -clap = "3.0.0-beta.4" +clap = "3.0.0-beta.5" color-eyre = "0.5" crossbeam-channel = "0.5" crossbeam-utils = "0.8" diff --git a/komorebi/src/main.rs b/komorebi/src/main.rs index 218a87d7..f9f3aa6d 100644 --- a/komorebi/src/main.rs +++ b/komorebi/src/main.rs @@ -13,7 +13,7 @@ use std::thread; #[cfg(feature = "deadlock_detection")] use std::time::Duration; -use clap::Clap; +use clap::Parser; use color_eyre::eyre::anyhow; use color_eyre::Result; use crossbeam_channel::Receiver; @@ -260,7 +260,7 @@ fn detect_deadlocks() { }); } -#[derive(Clap)] +#[derive(Parser)] #[clap(author, about, version)] struct Opts { /// Allow the use of komorebi's custom focus-follows-mouse implementation diff --git a/komorebic/Cargo.toml b/komorebic/Cargo.toml index 0a1993b5..24103f2c 100644 --- a/komorebic/Cargo.toml +++ b/komorebic/Cargo.toml @@ -14,7 +14,7 @@ edition = "2021" derive-ahk = { path = "../derive-ahk" } komorebi-core = { path = "../komorebi-core" } -clap = "3.0.0-beta.4" +clap = "3.0.0-beta.5" color-eyre = "0.5" dirs = "4" fs-tail = "0.1" diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 7d84e1ac..905e6817 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -12,7 +12,7 @@ use std::process::Command; use clap::AppSettings; use clap::ArgEnum; -use clap::Clap; +use clap::Parser; use color_eyre::eyre::anyhow; use color_eyre::Result; use fs_tail::TailedFile; @@ -46,7 +46,7 @@ trait AhkFunction { fn generate_ahk_function() -> String; } -#[derive(ArgEnum)] +#[derive(Copy, Clone, ArgEnum)] enum BooleanState { Enable, Disable, @@ -66,7 +66,7 @@ macro_rules! gen_enum_subcommand_args { ( $( $name:ident: $element:ty ),+ $(,)? ) => { $( paste! { - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct $name { #[clap(arg_enum)] [<$element:snake>]: $element @@ -96,7 +96,7 @@ macro_rules! gen_target_subcommand_args { // SubCommand Pattern ( $( $name:ident ),+ $(,)? ) => { $( - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct $name { /// Target index (zero-indexed) target: usize, @@ -122,7 +122,7 @@ macro_rules! gen_workspace_subcommand_args { ( $( $name:ident: $(#[enum] $(@$arg_enum:tt)?)? $value:ty ),+ $(,)? ) => ( paste! { $( - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct [] { /// Monitor index (zero-indexed) monitor: usize, @@ -148,7 +148,7 @@ gen_workspace_subcommand_args! { Tiling: #[enum] BooleanState, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] pub struct WorkspaceCustomLayout { /// Monitor index (zero-indexed) monitor: usize, @@ -160,7 +160,7 @@ pub struct WorkspaceCustomLayout { path: String, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Resize { #[clap(arg_enum)] edge: OperationDirection, @@ -168,7 +168,7 @@ struct Resize { sizing: Sizing, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct InvisibleBorders { /// Size of the left invisible border left: i32, @@ -180,7 +180,7 @@ struct InvisibleBorders { bottom: i32, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct WorkAreaOffset { /// Size of the left work area offset (set right to left * 2 to maintain right padding) left: i32, @@ -192,7 +192,7 @@ struct WorkAreaOffset { bottom: i32, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct EnsureWorkspaces { /// Monitor index (zero-indexed) monitor: usize, @@ -204,7 +204,7 @@ macro_rules! gen_padding_subcommand_args { // SubCommand Pattern ( $( $name:ident ),+ $(,)? ) => { $( - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct $name { /// Monitor index (zero-indexed) monitor: usize, @@ -226,7 +226,7 @@ macro_rules! gen_padding_adjustment_subcommand_args { // SubCommand Pattern ( $( $name:ident ),+ $(,)? ) => { $( - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct $name { #[clap(arg_enum)] sizing: Sizing, @@ -246,7 +246,7 @@ macro_rules! gen_application_target_subcommand_args { // SubCommand Pattern ( $( $name:ident ),+ $(,)? ) => { $( - #[derive(clap::Clap, derive_ahk::AhkFunction)] + #[derive(clap::Parser, derive_ahk::AhkFunction)] pub struct $name { #[clap(arg_enum)] identifier: ApplicationIdentifier, @@ -264,7 +264,7 @@ gen_application_target_subcommand_args! { IdentifyBorderOverflow, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct WorkspaceRule { #[clap(arg_enum)] identifier: ApplicationIdentifier, @@ -276,13 +276,13 @@ struct WorkspaceRule { workspace: usize, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct ToggleFocusFollowsMouse { #[clap(arg_enum, short, long, default_value = "windows")] implementation: FocusFollowsMouseImplementation, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct FocusFollowsMouse { #[clap(arg_enum, short, long, default_value = "windows")] implementation: FocusFollowsMouseImplementation, @@ -290,51 +290,51 @@ struct FocusFollowsMouse { boolean_state: BooleanState, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Start { /// Allow the use of komorebi's custom focus-follows-mouse implementation #[clap(long)] ffm: bool, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Save { /// File to which the resize layout dimensions should be saved path: String, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Load { /// File from which the resize layout dimensions should be loaded path: String, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct LoadCustomLayout { /// JSON or YAML file from which the custom layout definition should be loaded path: String, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Subscribe { /// Name of the pipe to send event notifications to (without "\\.\pipe\" prepended) named_pipe: String, } -#[derive(Clap, AhkFunction)] +#[derive(Parser, AhkFunction)] struct Unsubscribe { /// Name of the pipe to stop sending event notifications to (without "\\.\pipe\" prepended) named_pipe: String, } -#[derive(Clap)] +#[derive(Parser)] #[clap(author, about, version, setting = AppSettings::DeriveDisplayOrder)] struct Opts { #[clap(subcommand)] subcmd: SubCommand, } -#[derive(Clap, AhkLibrary)] +#[derive(Parser, AhkLibrary)] enum SubCommand { /// Start komorebi.exe as a background process Start(Start), @@ -871,24 +871,18 @@ fn main() -> Result<()> { send_message(&*SocketMessage::ResizeWindow(resize.edge, resize.sizing).as_bytes()?)?; } SubCommand::FocusFollowsMouse(arg) => { - let enable = match arg.boolean_state { - BooleanState::Enable => true, - BooleanState::Disable => false, - }; - send_message( - &*SocketMessage::FocusFollowsMouse(arg.implementation, enable).as_bytes()?, + &*SocketMessage::FocusFollowsMouse(arg.implementation, arg.boolean_state.into()) + .as_bytes()?, )?; } SubCommand::ReloadConfiguration => { send_message(&*SocketMessage::ReloadConfiguration.as_bytes()?)?; } SubCommand::WatchConfiguration(arg) => { - let enable = match arg.boolean_state { - BooleanState::Enable => true, - BooleanState::Disable => false, - }; - send_message(&*SocketMessage::WatchConfiguration(enable).as_bytes()?)?; + send_message( + &*SocketMessage::WatchConfiguration(arg.boolean_state.into()).as_bytes()?, + )?; } SubCommand::IdentifyTrayApplication(target) => { send_message( @@ -929,12 +923,7 @@ fn main() -> Result<()> { send_message(&*SocketMessage::ToggleMouseFollowsFocus.as_bytes()?)?; } SubCommand::MouseFollowsFocus(arg) => { - let enable = match arg.boolean_state { - BooleanState::Enable => true, - BooleanState::Disable => false, - }; - - send_message(&*SocketMessage::MouseFollowsFocus(enable).as_bytes()?)?; + send_message(&*SocketMessage::MouseFollowsFocus(arg.boolean_state.into()).as_bytes()?)?; } }