Update clap to v4.2.7

Fixes #6879.
Fixes #6874.
This commit is contained in:
Kirill Chibisov 2023-05-16 08:57:39 +03:00
parent 04811c674b
commit 6f6ad2b2ee
12 changed files with 476 additions and 159 deletions

View File

@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- Mode-specific bindings can now be bound in any mode for easier macros
- `--help` output is more compact now and uses more neutral palette
### Fixed

262
Cargo.lock generated
View File

@ -66,7 +66,7 @@ dependencies = [
"quote",
"serde",
"serde_yaml",
"syn",
"syn 2.0.16",
]
[[package]]
@ -121,6 +121,55 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
[[package]]
name = "anstream"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]]
name = "anstyle-parse"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
dependencies = [
"anstyle",
"windows-sys 0.48.0",
]
[[package]]
name = "arrayref"
version = "0.3.6"
@ -133,17 +182,6 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@ -259,51 +297,54 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.21"
version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7"
checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938"
dependencies = [
"atty",
"bitflags 1.3.2",
"clap_builder",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
]
[[package]]
name = "clap_builder"
version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd"
dependencies = [
"anstream",
"anstyle",
"bitflags 1.3.2",
"clap_lex",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_complete"
version = "3.2.5"
version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8"
checksum = "1594fe2312ec4abf402076e407628f5c313e54c32ade058521df4ee34ecac8a8"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "3.2.18"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 2.0.16",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
[[package]]
name = "clipboard-win"
@ -355,6 +396,12 @@ dependencies = [
"objc",
]
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "copypasta"
version = "0.8.2"
@ -548,6 +595,27 @@ dependencies = [
"winreg",
]
[[package]]
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "expat-sys"
version = "2.1.6"
@ -613,7 +681,7 @@ checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.99",
]
[[package]]
@ -773,12 +841,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "home"
@ -831,6 +896,17 @@ dependencies = [
"web-sys",
]
[[package]]
name = "io-lifetimes"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "iovec"
version = "0.1.4"
@ -840,6 +916,18 @@ dependencies = [
"libc",
]
[[package]]
name = "is-terminal"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys 0.48.0",
]
[[package]]
name = "itoa"
version = "1.0.3"
@ -926,9 +1014,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.132"
version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "libloading"
@ -946,6 +1034,12 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f"
[[package]]
name = "lock_api"
version = "0.4.8"
@ -1213,7 +1307,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
"syn 1.0.99",
]
[[package]]
@ -1295,12 +1389,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "os_str_bytes"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1384,44 +1472,20 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.43"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
checksum = "c4ec6d5fe0b140acb27c9a0444118cf55bfbb4e0b259739429abb4521dd67c16"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
dependencies = [
"proc-macro2",
]
@ -1488,6 +1552,20 @@ dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "0.37.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
dependencies = [
"bitflags 1.3.2",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.48.0",
]
[[package]]
name = "ryu"
version = "1.0.11"
@ -1536,22 +1614,22 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
[[package]]
name = "serde"
version = "1.0.144"
version = "1.0.163"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.144"
version = "1.0.163"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.16",
]
[[package]]
@ -1712,20 +1790,16 @@ dependencies = [
]
[[package]]
name = "termcolor"
version = "1.1.3"
name = "syn"
version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
dependencies = [
"winapi-util",
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "textwrap"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
[[package]]
name = "thiserror"
version = "1.0.35"
@ -1743,7 +1817,7 @@ checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.99",
]
[[package]]
@ -1794,9 +1868,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "utf8parse"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "vec_map"
@ -1888,7 +1962,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 1.0.99",
"wasm-bindgen-shared",
]
@ -1910,7 +1984,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.99",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View File

@ -24,7 +24,7 @@ version = "0.1.2-dev"
[dependencies]
bitflags = "2.2.1"
clap = { version = "3.0.0", features = ["derive", "env"] }
clap = { version = "4.2.7", features = ["derive", "env"] }
copypasta = { version = "0.8.1", default-features = false }
crossfont = { version = "0.5.0", features = ["force_system_fontconfig"] }
fnv = "1"
@ -46,7 +46,7 @@ winit = { version = "0.28.2", default-features = false, features = ["serde"] }
gl_generator = "0.14.0"
[dev-dependencies]
clap_complete = "3.0.0"
clap_complete = "4.2.3"
[target.'cfg(not(windows))'.dependencies]
xdg = "2.5.0"

View File

@ -4,7 +4,7 @@ use std::path::PathBuf;
#[cfg(unix)]
use clap::Subcommand;
use clap::{Args, Parser, ValueHint};
use clap::{ArgAction, Args, Parser, ValueHint};
use log::{self, error, LevelFilter};
use serde::{Deserialize, Serialize};
use serde_yaml::Value;
@ -51,15 +51,15 @@ pub struct Options {
pub socket: Option<PathBuf>,
/// Reduces the level of verbosity (the min level is -qq).
#[clap(short, conflicts_with("verbose"), parse(from_occurrences))]
#[clap(short, conflicts_with("verbose"), action = ArgAction::Count)]
quiet: u8,
/// Increases the level of verbosity (the max level is -vvv).
#[clap(short, conflicts_with("quiet"), parse(from_occurrences))]
#[clap(short, conflicts_with("quiet"), action = ArgAction::Count)]
verbose: u8,
/// Override configuration file options [example: cursor.style=Beam].
#[clap(short = 'o', long, multiple_values = true)]
#[clap(short = 'o', long, num_args = 1..)]
option: Vec<String>,
/// CLI options for config overrides.
@ -195,7 +195,7 @@ pub struct TerminalOptions {
pub hold: bool,
/// Command and args to execute (must be last argument).
#[clap(short = 'e', long, allow_hyphen_values = true, multiple_values = true)]
#[clap(short = 'e', long, allow_hyphen_values = true, num_args = 1..)]
command: Vec<String>,
}
@ -242,7 +242,7 @@ pub struct WindowIdentity {
pub title: Option<String>,
/// Defines window class/app_id on X11/Wayland [default: Alacritty].
#[clap(long, value_name = "general> | <general>,<instance", parse(try_from_str = parse_class))]
#[clap(long, value_name = "general> | <general>,<instance", value_parser = parse_class)]
pub class: Option<Class>,
}
@ -330,7 +330,7 @@ mod tests {
use std::io::Read;
#[cfg(target_os = "linux")]
use clap::IntoApp;
use clap::CommandFactory;
#[cfg(target_os = "linux")]
use clap_complete::Shell;
use serde_yaml::mapping::Mapping;
@ -446,7 +446,7 @@ mod tests {
#[cfg(target_os = "linux")]
#[test]
fn completions() {
let mut clap = Options::into_app();
let mut clap = Options::command();
for (shell, file) in &[
(Shell::Bash, "alacritty.bash"),

View File

@ -11,7 +11,7 @@ rust-version = "1.60.0"
[dependencies]
log = { version = "0.4.17", features = ["serde"] }
serde_yaml = "0.8.24"
serde = "1.0.137"
serde = "1.0.163"
[target.'cfg(target_os = "macos")'.dependencies]
winit = { version = "0.28.2", default-features = false, features = ["serde"] }

View File

@ -12,7 +12,7 @@ rust-version = "1.60.0"
proc-macro = true
[dependencies]
syn = { version = "1.0.53", features = ["derive", "parsing", "proc-macro", "printing"], default-features = false }
syn = { version = "2.0.16", features = ["derive", "parsing", "proc-macro", "printing"], default-features = false }
proc-macro2 = "1.0.24"
quote = "1.0.7"

View File

@ -1,6 +1,7 @@
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::{format_ident, quote};
use syn::meta::ParseNestedMeta;
use syn::{DataEnum, Generics, Ident};
use crate::serde_replace;
@ -14,7 +15,14 @@ pub fn derive_deserialize(ident: Ident, generics: Generics, data_enum: DataEnum)
for variant in data_enum.variants.iter().filter(|variant| {
// Skip deserialization for `#[config(skip)]` fields.
variant.attrs.iter().all(|attr| {
!crate::path_ends_with(&attr.path, "config") || attr.tokens.to_string() != "(skip)"
let is_skip = |meta: ParseNestedMeta| {
if meta.path.is_ident("skip") {
Ok(())
} else {
Err(meta.error("not skip"))
}
};
!attr.path().is_ident("config") || attr.parse_nested_meta(is_skip).is_err()
})
}) {
let variant_ident = &variant.ident;

View File

@ -115,7 +115,7 @@ fn field_deserializer(field_streams: &mut FieldStreams, field: &Field) -> Result
};
// Iterate over all #[config(...)] attributes.
for attr in field.attrs.iter().filter(|attr| crate::path_ends_with(&attr.path, "config")) {
for attr in field.attrs.iter().filter(|attr| attr.path().is_ident("config")) {
let parsed = match attr.parse_args::<Attr>() {
Ok(parsed) => parsed,
Err(_) => continue,
@ -161,7 +161,7 @@ fn field_deserializer(field_streams: &mut FieldStreams, field: &Field) -> Result
// Create token stream for deserializing "none" string into `Option<T>`.
if let Type::Path(type_path) = &field.ty {
if crate::path_ends_with(&type_path.path, "Option") {
if type_path.path.segments.iter().last().map_or(false, |s| s.ident == "Option") {
match_assignment_stream = quote! {
if value.as_str().map_or(false, |s| s.eq_ignore_ascii_case("none")) {
config.#ident = None;

View File

@ -6,7 +6,7 @@ use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::parse::{self, Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{GenericParam, Ident, LitStr, Path, Token, TypeParam};
use syn::{GenericParam, Ident, LitStr, Token, TypeParam};
mod config_deserialize;
mod serde_replace;
@ -25,12 +25,6 @@ pub fn derive_serde_replace(input: TokenStream) -> TokenStream {
serde_replace::derive(input)
}
/// Verify that a token path ends with a specific segment.
pub(crate) fn path_ends_with(path: &Path, segment: &str) -> bool {
let segments = path.segments.iter();
segments.last().map_or(false, |s| s.ident == segment)
}
/// Storage for all necessary generics information.
#[derive(Default)]
struct GenericsStreams {

View File

@ -16,25 +16,25 @@ _alacritty() {
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'--embed=[X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix)]:EMBED: ' \
'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE:_files' \
'--config-file=[Specify alternative configuration file \[default\: \$XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE:_files' \
'--socket=[Path for IPC socket creation]:SOCKET:_files' \
'*-o+[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
'*--option=[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
'*-o+[Override configuration file options \[example\: cursor.style=Beam\]]:OPTION: ' \
'*--option=[Override configuration file options \[example\: cursor.style=Beam\]]:OPTION: ' \
'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY:_files' \
'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
'-T+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:general> | <general>,<instance: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-T+[Defines the window title \[default\: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default\: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default\: Alacritty\]]:general> | <general>,<instance: ' \
'--print-events[Print all events to stdout]' \
'--ref-test[Generates ref test]' \
'(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \
'(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \
'--hold[Remain open after child process exit]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_alacritty_commands" \
"*::: :->alacritty" \
&& ret=0
@ -48,8 +48,8 @@ _alacritty() {
_arguments "${_arguments_options[@]}" \
'-s+[IPC socket connection path override]:SOCKET:_files' \
'--socket=[IPC socket connection path override]:SOCKET:_files' \
'-h[Print help information]' \
'--help[Print help information]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_alacritty__msg_commands" \
"*::: :->msg" \
&& ret=0
@ -65,12 +65,12 @@ _arguments "${_arguments_options[@]}" \
'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY:_files' \
'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
'-T+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:general> | <general>,<instance: ' \
'-T+[Defines the window title \[default\: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default\: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default\: Alacritty\]]:general> | <general>,<instance: ' \
'--hold[Remain open after child process exit]' \
'-h[Print help information]' \
'--help[Print help information]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(config)
@ -79,14 +79,73 @@ _arguments "${_arguments_options[@]}" \
'--window-id=[Window ID for the new config]:WINDOW_ID: ' \
'()-r[Clear all runtime configuration changes]' \
'()--reset[Clear all runtime configuration changes]' \
'-h[Print help information]' \
'--help[Print help information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::options -- Configuration file options \[example\: cursor.style=Beam\]:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
":: :_alacritty__msg__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:alacritty-msg-help-command-$line[1]:"
case $line[1] in
(create-window)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_alacritty__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:alacritty-help-command-$line[1]:"
case $line[1] in
(msg)
_arguments "${_arguments_options[@]}" \
":: :_alacritty__help__msg_commands" \
"*::: :->msg" \
&& ret=0
case $state in
(msg)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:alacritty-help-msg-command-$line[1]:"
case $line[1] in
(create-window)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
@ -95,12 +154,15 @@ esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_alacritty_commands] )) ||
@ -111,26 +173,71 @@ _alacritty_commands() {
)
_describe -t commands 'alacritty commands' commands "$@"
}
(( $+functions[_alacritty__help__msg__config_commands] )) ||
_alacritty__help__msg__config_commands() {
local commands; commands=()
_describe -t commands 'alacritty help msg config commands' commands "$@"
}
(( $+functions[_alacritty__msg__config_commands] )) ||
_alacritty__msg__config_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg config commands' commands "$@"
}
(( $+functions[_alacritty__msg__help__config_commands] )) ||
_alacritty__msg__help__config_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg help config commands' commands "$@"
}
(( $+functions[_alacritty__help__msg__create-window_commands] )) ||
_alacritty__help__msg__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty help msg create-window commands' commands "$@"
}
(( $+functions[_alacritty__msg__create-window_commands] )) ||
_alacritty__msg__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg create-window commands' commands "$@"
}
(( $+functions[_alacritty__msg__help__create-window_commands] )) ||
_alacritty__msg__help__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg help create-window commands' commands "$@"
}
(( $+functions[_alacritty__help_commands] )) ||
_alacritty__help_commands() {
local commands; commands=()
local commands; commands=(
'msg:Send a message to the Alacritty socket' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty help commands' commands "$@"
}
(( $+functions[_alacritty__help__help_commands] )) ||
_alacritty__help__help_commands() {
local commands; commands=()
_describe -t commands 'alacritty help help commands' commands "$@"
}
(( $+functions[_alacritty__msg__help_commands] )) ||
_alacritty__msg__help_commands() {
local commands; commands=()
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty msg help commands' commands "$@"
}
(( $+functions[_alacritty__msg__help__help_commands] )) ||
_alacritty__msg__help__help_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg help help commands' commands "$@"
}
(( $+functions[_alacritty__help__msg_commands] )) ||
_alacritty__help__msg_commands() {
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
)
_describe -t commands 'alacritty help msg commands' commands "$@"
}
(( $+functions[_alacritty__msg_commands] )) ||
_alacritty__msg_commands() {
local commands; commands=(
@ -141,4 +248,8 @@ _alacritty__msg_commands() {
_describe -t commands 'alacritty msg commands' commands "$@"
}
_alacritty "$@"
if [ "$funcstack[1]" = "_alacritty" ]; then
_alacritty "$@"
else
compdef _alacritty alacritty
fi

View File

@ -1,5 +1,5 @@
_alacritty() {
local i cur prev opts cmds
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@ -8,21 +8,45 @@ _alacritty() {
for i in ${COMP_WORDS[@]}
do
case "${i}" in
"$1")
case "${cmd},${i}" in
",$1")
cmd="alacritty"
;;
config)
cmd+="__config"
alacritty,help)
cmd="alacritty__help"
;;
create-window)
cmd+="__create__window"
alacritty,msg)
cmd="alacritty__msg"
;;
help)
cmd+="__help"
alacritty__help,help)
cmd="alacritty__help__help"
;;
msg)
cmd+="__msg"
alacritty__help,msg)
cmd="alacritty__help__msg"
;;
alacritty__help__msg,config)
cmd="alacritty__help__msg__config"
;;
alacritty__help__msg,create-window)
cmd="alacritty__help__msg__create__window"
;;
alacritty__msg,config)
cmd="alacritty__msg__config"
;;
alacritty__msg,create-window)
cmd="alacritty__msg__create__window"
;;
alacritty__msg,help)
cmd="alacritty__msg__help"
;;
alacritty__msg__help,config)
cmd="alacritty__msg__help__config"
;;
alacritty__msg__help,create-window)
cmd="alacritty__msg__help__create__window"
;;
alacritty__msg__help,help)
cmd="alacritty__msg__help__help"
;;
*)
;;
@ -31,7 +55,7 @@ _alacritty() {
case "${cmd}" in
alacritty)
opts="-h -V -q -v -o -e -T --help --version --print-events --ref-test --embed --config-file --socket --option --working-directory --hold --command --title --class msg help"
opts="-q -v -o -e -T -h -V --print-events --ref-test --embed --config-file --socket --option --working-directory --hold --command --title --class --help --version msg help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@ -89,7 +113,7 @@ _alacritty() {
return 0
;;
alacritty__help)
opts="<SUBCOMMAND>..."
opts="msg help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@ -102,6 +126,62 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__help__help)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__help__msg)
opts="create-window config"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__help__msg__config)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__help__msg__create__window)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__msg)
opts="-s -h --socket --help create-window config help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
@ -185,7 +265,7 @@ _alacritty() {
return 0
;;
alacritty__msg__help)
opts="<SUBCOMMAND>..."
opts="create-window config help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@ -198,6 +278,48 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__msg__help__config)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__msg__help__create__window)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
alacritty__msg__help__help)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}

View File

@ -6,17 +6,17 @@ complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start
complete -c alacritty -n "__fish_use_subcommand" -s e -l command -d 'Command and args to execute (must be last argument)' -r
complete -c alacritty -n "__fish_use_subcommand" -s T -l title -d 'Defines the window title [default: Alacritty]' -r
complete -c alacritty -n "__fish_use_subcommand" -l class -d 'Defines window class/app_id on X11/Wayland [default: Alacritty]' -r
complete -c alacritty -n "__fish_use_subcommand" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_use_subcommand" -s V -l version -d 'Print version information'
complete -c alacritty -n "__fish_use_subcommand" -l print-events -d 'Print all events to stdout'
complete -c alacritty -n "__fish_use_subcommand" -l ref-test -d 'Generates ref test'
complete -c alacritty -n "__fish_use_subcommand" -s q -d 'Reduces the level of verbosity (the min level is -qq)'
complete -c alacritty -n "__fish_use_subcommand" -s v -d 'Increases the level of verbosity (the max level is -vvv)'
complete -c alacritty -n "__fish_use_subcommand" -l hold -d 'Remain open after child process exit'
complete -c alacritty -n "__fish_use_subcommand" -s h -l help -d 'Print help'
complete -c alacritty -n "__fish_use_subcommand" -s V -l version -d 'Print version'
complete -c alacritty -n "__fish_use_subcommand" -f -a "msg" -d 'Send a message to the Alacritty socket'
complete -c alacritty -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -s s -l socket -d 'IPC socket connection path override' -r -F
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "config" -d 'Update the Alacritty configuration'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
@ -25,7 +25,14 @@ complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subco
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -s T -l title -d 'Defines the window title [default: Alacritty]' -r
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -l class -d 'Defines window class/app_id on X11/Wayland [default: Alacritty]' -r
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -l hold -d 'Remain open after child process exit'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -s h -l help -d 'Print help'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from config" -s w -l window-id -d 'Window ID for the new config' -r
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from config" -s r -l reset -d 'Clear all runtime configuration changes'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from config" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from config" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "config" -d 'Update the Alacritty configuration'
complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from help" -f -a "msg" -d 'Send a message to the Alacritty socket'
complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
complete -c alacritty -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config" -f -a "config" -d 'Update the Alacritty configuration'