mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-04 20:21:35 +02:00
refactor(macros): add trailing commas
This commit is contained in:
@@ -8,11 +8,11 @@ use ::std::convert::Into;
|
|||||||
use ::std::iter::Extend;
|
use ::std::iter::Extend;
|
||||||
use ::std::iter::Iterator;
|
use ::std::iter::Iterator;
|
||||||
use ::std::matches;
|
use ::std::matches;
|
||||||
|
use ::std::option::Option::Some;
|
||||||
use ::std::string::ToString;
|
use ::std::string::ToString;
|
||||||
use ::std::unreachable;
|
use ::std::unreachable;
|
||||||
|
|
||||||
use ::quote::quote;
|
use ::quote::quote;
|
||||||
use ::std::option::Option::Some;
|
|
||||||
use ::syn::parse_macro_input;
|
use ::syn::parse_macro_input;
|
||||||
use ::syn::Data;
|
use ::syn::Data;
|
||||||
use ::syn::DataEnum;
|
use ::syn::DataEnum;
|
||||||
@@ -48,7 +48,7 @@ pub fn ahk_function(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStre
|
|||||||
}}"#,
|
}}"#,
|
||||||
::std::stringify!(#name),
|
::std::stringify!(#name),
|
||||||
#arguments,
|
#arguments,
|
||||||
stringify!(#name).to_kebab_case(),
|
::std::stringify!(#name).to_kebab_case(),
|
||||||
#called_arguments
|
#called_arguments
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-13
@@ -9,7 +9,6 @@ use std::io::ErrorKind;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::stringify;
|
|
||||||
|
|
||||||
use clap::AppSettings;
|
use clap::AppSettings;
|
||||||
use clap::ArgEnum;
|
use clap::ArgEnum;
|
||||||
@@ -61,7 +60,7 @@ impl From<BooleanState> for bool {
|
|||||||
|
|
||||||
macro_rules! gen_enum_subcommand_args {
|
macro_rules! gen_enum_subcommand_args {
|
||||||
// SubCommand Pattern: Enum Type
|
// SubCommand Pattern: Enum Type
|
||||||
( $( $name:ident: $element:ty ),+ ) => {
|
( $( $name:ident: $element:ty ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
paste! {
|
paste! {
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
@@ -82,12 +81,12 @@ gen_enum_subcommand_args! {
|
|||||||
FlipLayout: Flip,
|
FlipLayout: Flip,
|
||||||
ChangeLayout: Layout,
|
ChangeLayout: Layout,
|
||||||
WatchConfiguration: BooleanState,
|
WatchConfiguration: BooleanState,
|
||||||
FocusFollowsMouse: BooleanState
|
FocusFollowsMouse: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! gen_target_subcommand_args {
|
macro_rules! gen_target_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
@@ -104,7 +103,7 @@ gen_target_subcommand_args! {
|
|||||||
SendToMonitor,
|
SendToMonitor,
|
||||||
SendToWorkspace,
|
SendToWorkspace,
|
||||||
FocusMonitor,
|
FocusMonitor,
|
||||||
FocusWorkspace
|
FocusWorkspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thanks to @danielhenrymantilla for showing me how to use cfg_attr with an optional argument like
|
// Thanks to @danielhenrymantilla for showing me how to use cfg_attr with an optional argument like
|
||||||
@@ -112,7 +111,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] $(@$arg_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
||||||
paste! {
|
paste! {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
@@ -138,7 +137,7 @@ macro_rules! gen_workspace_subcommand_args {
|
|||||||
gen_workspace_subcommand_args! {
|
gen_workspace_subcommand_args! {
|
||||||
Name: String,
|
Name: String,
|
||||||
Layout: #[enum] Layout,
|
Layout: #[enum] Layout,
|
||||||
Tiling: #[enum] BooleanState
|
Tiling: #[enum] BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, AhkFunction)]
|
#[derive(Clap, AhkFunction)]
|
||||||
@@ -159,7 +158,7 @@ struct EnsureWorkspaces {
|
|||||||
|
|
||||||
macro_rules! gen_padding_subcommand_args {
|
macro_rules! gen_padding_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
@@ -176,12 +175,12 @@ macro_rules! gen_padding_subcommand_args {
|
|||||||
|
|
||||||
gen_padding_subcommand_args! {
|
gen_padding_subcommand_args! {
|
||||||
ContainerPadding,
|
ContainerPadding,
|
||||||
WorkspacePadding
|
WorkspacePadding,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! gen_padding_adjustment_subcommand_args {
|
macro_rules! gen_padding_adjustment_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
@@ -196,12 +195,12 @@ macro_rules! gen_padding_adjustment_subcommand_args {
|
|||||||
|
|
||||||
gen_padding_adjustment_subcommand_args! {
|
gen_padding_adjustment_subcommand_args! {
|
||||||
AdjustContainerPadding,
|
AdjustContainerPadding,
|
||||||
AdjustWorkspacePadding
|
AdjustWorkspacePadding,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! gen_application_target_subcommand_args {
|
macro_rules! gen_application_target_subcommand_args {
|
||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
#[derive(clap::Clap, derive_ahk::AhkFunction)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
@@ -217,7 +216,7 @@ macro_rules! gen_application_target_subcommand_args {
|
|||||||
gen_application_target_subcommand_args! {
|
gen_application_target_subcommand_args! {
|
||||||
FloatRule,
|
FloatRule,
|
||||||
ManageRule,
|
ManageRule,
|
||||||
IdentifyTrayApplication
|
IdentifyTrayApplication,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, AhkFunction)]
|
#[derive(Clap, AhkFunction)]
|
||||||
|
|||||||
Reference in New Issue
Block a user