mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-08 14:05:10 +02:00
fix(clap): address deprecations
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@@ -342,7 +342,9 @@ impl Arrangement for CustomLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum Axis {
|
pub enum Axis {
|
||||||
Horizontal,
|
Horizontal,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -8,7 +8,7 @@ use strum::EnumString;
|
|||||||
|
|
||||||
use crate::ApplicationIdentifier;
|
use crate::ApplicationIdentifier;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ApplicationOptions {
|
pub enum ApplicationOptions {
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use strum::Display;
|
use strum::Display;
|
||||||
use strum::EnumString;
|
use strum::EnumString;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum CycleDirection {
|
pub enum CycleDirection {
|
||||||
Previous,
|
Previous,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@@ -9,7 +9,9 @@ use crate::OperationDirection;
|
|||||||
use crate::Rect;
|
use crate::Rect;
|
||||||
use crate::Sizing;
|
use crate::Sizing;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum DefaultLayout {
|
pub enum DefaultLayout {
|
||||||
BSP,
|
BSP,
|
||||||
|
|||||||
+28
-10
@@ -4,7 +4,7 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -138,14 +138,18 @@ impl FromStr for SocketMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum WindowKind {
|
pub enum WindowKind {
|
||||||
Single,
|
Single,
|
||||||
Stack,
|
Stack,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum StateQuery {
|
pub enum StateQuery {
|
||||||
FocusedMonitorIndex,
|
FocusedMonitorIndex,
|
||||||
@@ -154,7 +158,9 @@ pub enum StateQuery {
|
|||||||
FocusedWindowIndex,
|
FocusedWindowIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ApplicationIdentifier {
|
pub enum ApplicationIdentifier {
|
||||||
@@ -163,42 +169,54 @@ pub enum ApplicationIdentifier {
|
|||||||
Title,
|
Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum FocusFollowsMouseImplementation {
|
pub enum FocusFollowsMouseImplementation {
|
||||||
Komorebi,
|
Komorebi,
|
||||||
Windows,
|
Windows,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum WindowContainerBehaviour {
|
pub enum WindowContainerBehaviour {
|
||||||
Create,
|
Create,
|
||||||
Append,
|
Append,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum MoveBehaviour {
|
pub enum MoveBehaviour {
|
||||||
Swap,
|
Swap,
|
||||||
Insert,
|
Insert,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Copy, Clone, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum HidingBehaviour {
|
pub enum HidingBehaviour {
|
||||||
Hide,
|
Hide,
|
||||||
Minimize,
|
Minimize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum OperationBehaviour {
|
pub enum OperationBehaviour {
|
||||||
Op,
|
Op,
|
||||||
NoOp,
|
NoOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum Sizing {
|
pub enum Sizing {
|
||||||
Increase,
|
Increase,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
use clap::ArgEnum;
|
use clap::ValueEnum;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@@ -10,7 +10,9 @@ use strum::EnumString;
|
|||||||
use crate::direction::Direction;
|
use crate::direction::Direction;
|
||||||
use crate::Axis;
|
use crate::Axis;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ArgEnum, JsonSchema)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, JsonSchema,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
pub enum OperationDirection {
|
pub enum OperationDirection {
|
||||||
Left,
|
Left,
|
||||||
|
|||||||
+20
-21
@@ -12,9 +12,8 @@ use std::path::PathBuf;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use clap::AppSettings;
|
|
||||||
use clap::ArgEnum;
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
use clap::ValueEnum;
|
||||||
use color_eyre::eyre::anyhow;
|
use color_eyre::eyre::anyhow;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use fs_tail::TailedFile;
|
use fs_tail::TailedFile;
|
||||||
@@ -77,7 +76,7 @@ trait AhkFunction {
|
|||||||
fn generate_ahk_function() -> String;
|
fn generate_ahk_function() -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, ArgEnum)]
|
#[derive(Copy, Clone, ValueEnum)]
|
||||||
enum BooleanState {
|
enum BooleanState {
|
||||||
Enable,
|
Enable,
|
||||||
Disable,
|
Disable,
|
||||||
@@ -99,7 +98,7 @@ macro_rules! gen_enum_subcommand_args {
|
|||||||
paste! {
|
paste! {
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
[<$element:snake>]: $element
|
[<$element:snake>]: $element
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +153,7 @@ gen_target_subcommand_args! {
|
|||||||
macro_rules! gen_workspace_subcommand_args {
|
macro_rules! gen_workspace_subcommand_args {
|
||||||
// Workspace Property: #[enum] Value Enum (if the value is an Enum)
|
// Workspace Property: #[enum] Value Enum (if the value is an Enum)
|
||||||
// Workspace Property: Value Type (if the value is anything else)
|
// Workspace Property: Value Type (if the value is anything else)
|
||||||
( $( $name:ident: $(#[enum] $(@$arg_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
||||||
paste! {
|
paste! {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
||||||
@@ -165,9 +164,9 @@ macro_rules! gen_workspace_subcommand_args {
|
|||||||
/// Workspace index on the specified monitor (zero-indexed)
|
/// Workspace index on the specified monitor (zero-indexed)
|
||||||
workspace: usize,
|
workspace: usize,
|
||||||
|
|
||||||
$(#[clap(arg_enum)] $($arg_enum)?)?
|
$(#[clap(value_enum)] $($value_enum)?)?
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
all($(FALSE $($arg_enum)?)?),
|
all($(FALSE $($value_enum)?)?),
|
||||||
doc = ""$name " of the workspace as a "$value ""
|
doc = ""$name " of the workspace as a "$value ""
|
||||||
)]
|
)]
|
||||||
value: $value,
|
value: $value,
|
||||||
@@ -215,7 +214,7 @@ pub struct WorkspaceLayoutRule {
|
|||||||
/// The number of window containers on-screen required to trigger this layout rule
|
/// The number of window containers on-screen required to trigger this layout rule
|
||||||
at_container_count: usize,
|
at_container_count: usize,
|
||||||
|
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
layout: DefaultLayout,
|
layout: DefaultLayout,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,17 +235,17 @@ pub struct WorkspaceCustomLayoutRule {
|
|||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct Resize {
|
struct Resize {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
edge: OperationDirection,
|
edge: OperationDirection,
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct ResizeAxis {
|
struct ResizeAxis {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
axis: Axis,
|
axis: Axis,
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +331,7 @@ macro_rules! gen_padding_adjustment_subcommand_args {
|
|||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
/// Pixels to adjust by as an integer
|
/// Pixels to adjust by as an integer
|
||||||
adjustment: i32,
|
adjustment: i32,
|
||||||
@@ -352,7 +351,7 @@ macro_rules! gen_application_target_subcommand_args {
|
|||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
/// Identifier as a string
|
/// Identifier as a string
|
||||||
id: String,
|
id: String,
|
||||||
@@ -372,7 +371,7 @@ gen_application_target_subcommand_args! {
|
|||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct WorkspaceRule {
|
struct WorkspaceRule {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
/// Identifier as a string
|
/// Identifier as a string
|
||||||
id: String,
|
id: String,
|
||||||
@@ -384,27 +383,27 @@ struct WorkspaceRule {
|
|||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct ToggleFocusFollowsMouse {
|
struct ToggleFocusFollowsMouse {
|
||||||
#[clap(arg_enum, short, long, default_value = "windows")]
|
#[clap(value_enum, short, long, default_value = "windows")]
|
||||||
implementation: FocusFollowsMouseImplementation,
|
implementation: FocusFollowsMouseImplementation,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct FocusFollowsMouse {
|
struct FocusFollowsMouse {
|
||||||
#[clap(arg_enum, short, long, default_value = "windows")]
|
#[clap(value_enum, short, long, default_value = "windows")]
|
||||||
implementation: FocusFollowsMouseImplementation,
|
implementation: FocusFollowsMouseImplementation,
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
boolean_state: BooleanState,
|
boolean_state: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct ActiveWindowBorder {
|
struct ActiveWindowBorder {
|
||||||
#[clap(arg_enum)]
|
#[clap(value_enum)]
|
||||||
boolean_state: BooleanState,
|
boolean_state: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
struct ActiveWindowBorderColour {
|
struct ActiveWindowBorderColour {
|
||||||
#[clap(arg_enum, short, long, default_value = "single")]
|
#[clap(value_enum, short, long, default_value = "single")]
|
||||||
window_kind: WindowKind,
|
window_kind: WindowKind,
|
||||||
/// Red
|
/// Red
|
||||||
r: u32,
|
r: u32,
|
||||||
@@ -472,7 +471,7 @@ struct FormatAppSpecificConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(author, about, version, setting = AppSettings::DeriveDisplayOrder)]
|
#[clap(author, about, version)]
|
||||||
struct Opts {
|
struct Opts {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
subcmd: SubCommand,
|
subcmd: SubCommand,
|
||||||
|
|||||||
Reference in New Issue
Block a user