Migrate from structopt to clap 3

This commit is contained in:
Christian Duerr 2022-01-04 19:25:26 +01:00 committed by GitHub
parent 75c14b9bb8
commit 437f42f8d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 219 additions and 248 deletions

View File

@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Minimum Rust version has been bumped to 1.56.0 - Minimum Rust version has been bumped to 1.56.0
### Changed
- The `--help` output was reworked with a new colorful syntax
## 0.10.0 ## 0.10.0
### Packaging ### Packaging

193
Cargo.lock generated
View File

@ -16,6 +16,7 @@ dependencies = [
"alacritty_terminal", "alacritty_terminal",
"bitflags", "bitflags",
"clap", "clap",
"clap_complete",
"cocoa", "cocoa",
"copypasta", "copypasta",
"crossfont", "crossfont",
@ -34,7 +35,6 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml", "serde_yaml",
"structopt",
"time", "time",
"unicode-width", "unicode-width",
"wayland-client", "wayland-client",
@ -88,15 +88,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -177,17 +168,41 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.34.0" version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" checksum = "17a98d95cbe8abdf3bfe1a2bd4aa7215700403b79a0eb03cbddb017a5824e186"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"strsim 0.8.0", "clap_derive",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width", ]
"vec_map",
[[package]]
name = "clap_complete"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a394f7ec0715b42a4e52b294984c27c9a61f77c8d82f7774c5198350be143f19"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "448c8b00367288ad41804ac7a9e0fe58f2324a36901cb5d6b6db58be86d1db8f"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -404,7 +419,7 @@ dependencies = [
"ident_case", "ident_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.10.0", "strsim",
"syn", "syn",
] ]
@ -419,17 +434,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "3.0.2" version = "3.0.2"
@ -725,12 +729,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
@ -855,9 +856,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.109" version = "0.2.112"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01" checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1141,19 +1142,18 @@ dependencies = [
[[package]] [[package]]
name = "num_enum" name = "num_enum"
version = "0.5.4" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
dependencies = [ dependencies = [
"derivative",
"num_enum_derive", "num_enum_derive",
] ]
[[package]] [[package]]
name = "num_enum_derive" name = "num_enum_derive"
version = "0.5.4" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@ -1192,9 +1192,18 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.8.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "osmesa-sys" name = "osmesa-sys"
@ -1289,18 +1298,27 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.33" version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a" checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]] [[package]]
name = "quote" name = "quick-xml"
version = "1.0.10" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -1350,9 +1368,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.7" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "254df5081ce98661a883445175e52efe99d1cb2a5552891d965d2f5d0cad1c16" checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]] [[package]]
name = "same-file" name = "same-file"
@ -1451,9 +1469,9 @@ dependencies = [
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c35dfd12afb7828318348b8c408383cf5071a086c1d4ab1c0f9840ec92dbb922" checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
dependencies = [ dependencies = [
"libc", "libc",
"signal-hook-registry", "signal-hook-registry",
@ -1527,47 +1545,17 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be6c3f39c37a4283ee4b43d1311c828f2e1fb0541e76ea0cb1a2abd9ef2f5b3b" checksum = "be6c3f39c37a4283ee4b43d1311c828f2e1fb0541e76ea0cb1a2abd9ef2f5b3b"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "structopt"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
dependencies = [
"clap",
"lazy_static",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.82" version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1575,14 +1563,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "textwrap" name = "termcolor"
version = "0.11.0" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [ dependencies = [
"unicode-width", "winapi-util",
] ]
[[package]]
name = "textwrap"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.30" version = "1.0.30"
@ -1622,12 +1616,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.9" version = "0.1.9"
@ -1646,17 +1634,11 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.3" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "vswhom" name = "vswhom"
@ -1970,9 +1952,9 @@ dependencies = [
[[package]] [[package]]
name = "x11-clipboard" name = "x11-clipboard"
version = "0.5.2" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b397ace6e980510de59a4fe3d4c758dffab231d6d747ce9fa1aba6b6035d5f32" checksum = "473068b7b80ac86a18328824f1054e5e007898c47b5bbc281bd7abe32bc3653c"
dependencies = [ dependencies = [
"xcb", "xcb",
] ]
@ -1990,12 +1972,13 @@ dependencies = [
[[package]] [[package]]
name = "xcb" name = "xcb"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6" checksum = "771e2b996df720cd1c6dd9ff90f62d91698fd3610cc078388d0564bdd6622a9c"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"quick-xml",
] ]
[[package]] [[package]]

View File

@ -19,7 +19,7 @@ path = "../alacritty_config_derive"
version = "0.1.0" version = "0.1.0"
[dependencies] [dependencies]
structopt = "0.3.22" clap = { version = "3.0.0", features = ["derive"] }
log = { version = "0.4", features = ["std", "serde"] } log = { version = "0.4", features = ["std", "serde"] }
time = "0.1.40" time = "0.1.40"
fnv = "1" fnv = "1"
@ -36,12 +36,12 @@ unicode-width = "0.1"
bitflags = "1" bitflags = "1"
dirs = "3.0.1" dirs = "3.0.1"
[dev-dependencies]
clap = "2.33.3"
[build-dependencies] [build-dependencies]
gl_generator = "0.14.0" gl_generator = "0.14.0"
[dev-dependencies]
clap_complete = "3.0.0"
[target.'cfg(not(windows))'.dependencies] [target.'cfg(not(windows))'.dependencies]
xdg = "2.4.0" xdg = "2.4.0"

View File

@ -1,10 +1,12 @@
use std::cmp::max; use std::cmp::max;
use std::path::PathBuf; use std::path::PathBuf;
#[cfg(unix)]
use clap::Subcommand;
use clap::{Args, Parser};
use log::{self, error, LevelFilter}; use log::{self, error, LevelFilter};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_yaml::Value; use serde_yaml::Value;
use structopt::StructOpt;
use alacritty_terminal::config::{Program, PtyConfig}; use alacritty_terminal::config::{Program, PtyConfig};
@ -12,70 +14,70 @@ use crate::config::window::{Class, Identity, DEFAULT_NAME};
use crate::config::{serde_utils, UiConfig}; use crate::config::{serde_utils, UiConfig};
/// CLI options for the main Alacritty executable. /// CLI options for the main Alacritty executable.
#[derive(StructOpt, Default, Debug)] #[derive(Parser, Default, Debug)]
#[structopt(author, about, version = env!("VERSION"))] #[clap(author, about, version = env!("VERSION"))]
pub struct Options { pub struct Options {
/// Print all events to stdout. /// Print all events to stdout.
#[structopt(long)] #[clap(long)]
pub print_events: bool, pub print_events: bool,
/// Generates ref test. /// Generates ref test.
#[structopt(long)] #[clap(long)]
pub ref_test: bool, pub ref_test: bool,
/// Defines the X11 window ID (as a decimal integer) to embed Alacritty within. /// Defines the X11 window ID (as a decimal integer) to embed Alacritty within.
#[structopt(long)] #[clap(long)]
pub embed: Option<String>, pub embed: Option<String>,
/// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]. /// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml].
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
#[structopt(long)] #[clap(long)]
pub config_file: Option<PathBuf>, pub config_file: Option<PathBuf>,
/// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml]. /// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml].
#[cfg(windows)] #[cfg(windows)]
#[structopt(long)] #[clap(long)]
pub config_file: Option<PathBuf>, pub config_file: Option<PathBuf>,
/// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml]. /// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml].
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
#[structopt(long)] #[clap(long)]
pub config_file: Option<PathBuf>, pub config_file: Option<PathBuf>,
/// Path for IPC socket creation. /// Path for IPC socket creation.
#[cfg(unix)] #[cfg(unix)]
#[structopt(long)] #[clap(long)]
pub socket: Option<PathBuf>, pub socket: Option<PathBuf>,
/// Reduces the level of verbosity (the min level is -qq). /// Reduces the level of verbosity (the min level is -qq).
#[structopt(short, conflicts_with("verbose"), parse(from_occurrences))] #[clap(short, conflicts_with("verbose"), parse(from_occurrences))]
quiet: u8, quiet: u8,
/// Increases the level of verbosity (the max level is -vvv). /// Increases the level of verbosity (the max level is -vvv).
#[structopt(short, conflicts_with("quiet"), parse(from_occurrences))] #[clap(short, conflicts_with("quiet"), parse(from_occurrences))]
verbose: u8, verbose: u8,
/// Override configuration file options [example: cursor.style=Beam]. /// Override configuration file options [example: cursor.style=Beam].
#[structopt(short = "o", long)] #[clap(short = 'o', long, multiple_values = true)]
option: Vec<String>, option: Vec<String>,
/// CLI options for config overrides. /// CLI options for config overrides.
#[structopt(skip)] #[clap(skip)]
pub config_options: Value, pub config_options: Value,
/// Options which could be passed via IPC. /// Options which can be passed via IPC.
#[structopt(flatten)] #[clap(flatten)]
pub window_options: WindowOptions, pub window_options: WindowOptions,
/// Subcommand passed to the CLI. /// Subcommand passed to the CLI.
#[cfg(unix)] #[cfg(unix)]
#[structopt(subcommand)] #[clap(subcommand)]
pub subcommands: Option<Subcommands>, pub subcommands: Option<Subcommands>,
} }
impl Options { impl Options {
pub fn new() -> Self { pub fn new() -> Self {
let mut options = Self::from_args(); let mut options = Self::parse();
// Convert `--option` flags into serde `Value`. // Convert `--option` flags into serde `Value`.
for option in &options.option { for option in &options.option {
@ -172,18 +174,18 @@ fn parse_class(input: &str) -> Result<Class, String> {
} }
/// Terminal specific cli options which can be passed to new windows via IPC. /// Terminal specific cli options which can be passed to new windows via IPC.
#[derive(Serialize, Deserialize, StructOpt, Default, Debug, Clone, PartialEq)] #[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq)]
pub struct TerminalOptions { pub struct TerminalOptions {
/// Start the shell in the specified working directory. /// Start the shell in the specified working directory.
#[structopt(long)] #[clap(long)]
pub working_directory: Option<PathBuf>, pub working_directory: Option<PathBuf>,
/// Remain open after child process exit. /// Remain open after child process exit.
#[structopt(long)] #[clap(long)]
pub hold: bool, pub hold: bool,
/// Command and args to execute (must be last argument). /// Command and args to execute (must be last argument).
#[structopt(short = "e", long, allow_hyphen_values = true)] #[clap(short = 'e', long, allow_hyphen_values = true, multiple_values = true)]
command: Vec<String>, command: Vec<String>,
} }
@ -223,14 +225,14 @@ impl From<TerminalOptions> for PtyConfig {
} }
/// Window specific cli options which can be passed to new windows via IPC. /// Window specific cli options which can be passed to new windows via IPC.
#[derive(Serialize, Deserialize, StructOpt, Default, Debug, Clone, PartialEq)] #[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq)]
pub struct WindowIdentity { pub struct WindowIdentity {
/// Defines the window title [default: Alacritty]. /// Defines the window title [default: Alacritty].
#[structopt(short, long)] #[clap(short, long)]
pub title: Option<String>, pub title: Option<String>,
/// Defines window class/app_id on X11/Wayland [default: Alacritty]. /// Defines window class/app_id on X11/Wayland [default: Alacritty].
#[structopt(long, value_name = "instance> | <instance>,<general", parse(try_from_str = parse_class))] #[clap(long, value_name = "instance> | <instance>,<general", parse(try_from_str = parse_class))]
pub class: Option<Class>, pub class: Option<Class>,
} }
@ -248,40 +250,40 @@ impl WindowIdentity {
/// Available CLI subcommands. /// Available CLI subcommands.
#[cfg(unix)] #[cfg(unix)]
#[derive(StructOpt, Debug)] #[derive(Subcommand, Debug)]
pub enum Subcommands { pub enum Subcommands {
Msg(MessageOptions), Msg(MessageOptions),
} }
/// Send a message to the Alacritty socket. /// Send a message to the Alacritty socket.
#[cfg(unix)] #[cfg(unix)]
#[derive(StructOpt, Debug)] #[derive(Args, Debug)]
pub struct MessageOptions { pub struct MessageOptions {
/// IPC socket connection path override. /// IPC socket connection path override.
#[structopt(long, short)] #[clap(long, short)]
pub socket: Option<PathBuf>, pub socket: Option<PathBuf>,
/// Message which should be sent. /// Message which should be sent.
#[structopt(subcommand)] #[clap(subcommand)]
pub message: SocketMessage, pub message: SocketMessage,
} }
/// Available socket messages. /// Available socket messages.
#[cfg(unix)] #[cfg(unix)]
#[derive(StructOpt, Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Subcommand, Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum SocketMessage { pub enum SocketMessage {
/// Create a new window in the same Alacritty process. /// Create a new window in the same Alacritty process.
CreateWindow(WindowOptions), CreateWindow(WindowOptions),
} }
/// Subset of options that we pass to a 'create-window' subcommand. /// Subset of options that we pass to a 'create-window' subcommand.
#[derive(StructOpt, Serialize, Deserialize, Default, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Args, Default, Clone, Debug, PartialEq)]
pub struct WindowOptions { pub struct WindowOptions {
/// Terminal options which can be passed via IPC. /// Terminal options which can be passed via IPC.
#[structopt(flatten)] #[clap(flatten)]
pub terminal_options: TerminalOptions, pub terminal_options: TerminalOptions,
#[structopt(flatten)] #[clap(flatten)]
/// Window options which could be passed via IPC. /// Window options which could be passed via IPC.
pub window_identity: WindowIdentity, pub window_identity: WindowIdentity,
} }
@ -296,7 +298,9 @@ mod tests {
use std::io::Read; use std::io::Read;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use clap::Shell; use clap::IntoApp;
#[cfg(target_os = "linux")]
use clap_complete::Shell;
use serde_yaml::mapping::Mapping; use serde_yaml::mapping::Mapping;
#[test] #[test]
@ -392,7 +396,7 @@ mod tests {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
#[test] #[test]
fn completions() { fn completions() {
let mut clap = Options::clap(); let mut clap = Options::into_app();
for (shell, file) in &[ for (shell, file) in &[
(Shell::Bash, "alacritty.bash"), (Shell::Bash, "alacritty.bash"),
@ -400,7 +404,7 @@ mod tests {
(Shell::Zsh, "_alacritty"), (Shell::Zsh, "_alacritty"),
] { ] {
let mut generated = Vec::new(); let mut generated = Vec::new();
clap.gen_completions_to("alacritty", *shell, &mut generated); clap_complete::generate(*shell, &mut clap, "alacritty", &mut generated);
let generated = String::from_utf8_lossy(&generated); let generated = String::from_utf8_lossy(&generated);
let mut completion = String::new(); let mut completion = String::new();
@ -412,8 +416,11 @@ mod tests {
// NOTE: Use this to generate new completions. // NOTE: Use this to generate new completions.
// //
// clap.gen_completions("alacritty", Shell::Bash, "../extra/completions/"); // let mut file = File::create("../extra/completions/alacritty.bash").unwrap();
// clap.gen_completions("alacritty", Shell::Fish, "../extra/completions/"); // clap_complete::generate(Shell::Bash, &mut clap, "alacritty", &mut file);
// clap.gen_completions("alacritty", Shell::Zsh, "../extra/completions/"); // let mut file = File::create("../extra/completions/alacritty.fish").unwrap();
// clap_complete::generate(Shell::Fish, &mut clap, "alacritty", &mut file);
// let mut file = File::create("../extra/completions/_alacritty").unwrap();
// clap_complete::generate(Shell::Zsh, &mut clap, "alacritty", &mut file);
} }
} }

View File

@ -15,26 +15,26 @@ _alacritty() {
local context curcontext="$curcontext" state line local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]' \ '--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]:EMBED: ' \
'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]' \ '--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE: ' \
'--socket=[Path for IPC socket creation]' \ '--socket=[Path for IPC socket creation]:SOCKET: ' \
'*-o+[Override configuration file options \[example: cursor.style=Beam\]]' \ '*-o+[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
'*--option=[Override configuration file options \[example: cursor.style=Beam\]]' \ '*--option=[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
'--working-directory=[Start the shell in the specified working directory]' \ '--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \
'*-e+[Command and args to execute (must be last argument)]' \ '*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
'*--command=[Command and args to execute (must be last argument)]' \ '*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
'-t+[Defines the window title \[default: Alacritty\]]' \ '-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default: Alacritty\]]' \ '--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]' \ '--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | <instance>,<general: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'--print-events[Print all events to stdout]' \ '--print-events[Print all events to stdout]' \
'--ref-test[Generates ref test]' \ '--ref-test[Generates ref test]' \
'(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \ '(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \
'(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \ '(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \
'--hold[Remain open after child process exit]' \ '--hold[Remain open after child process exit]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_alacritty_commands" \ ":: :_alacritty_commands" \
"*::: :->alacritty" \ "*::: :->alacritty" \
&& ret=0 && ret=0
@ -46,16 +46,15 @@ _alacritty() {
case $line[1] in case $line[1] in
(msg) (msg)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'-s+[IPC socket connection path override]' \ '-s+[IPC socket connection path override]:SOCKET: ' \
'--socket=[IPC socket connection path override]' \ '--socket=[IPC socket connection path override]:SOCKET: ' \
'-h[Prints help information]' \ '-h[Print help information]' \
'--help[Prints help information]' \ '--help[Print help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_alacritty__msg_commands" \ ":: :_alacritty__msg_commands" \
"*::: :->msg" \ "*::: :->msg" \
&& ret=0 && ret=0
case $state in
case $state in
(msg) (msg)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
@ -63,25 +62,23 @@ case $state in
case $line[1] in case $line[1] in
(create-window) (create-window)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'--working-directory=[Start the shell in the specified working directory]' \ '--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \
'*-e+[Command and args to execute (must be last argument)]' \ '*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
'*--command=[Command and args to execute (must be last argument)]' \ '*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
'-t+[Defines the window title \[default: Alacritty\]]' \ '-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--title=[Defines the window title \[default: Alacritty\]]' \ '--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]' \ '--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | <instance>,<general: ' \
'--version[Print version information]' \
'--hold[Remain open after child process exit]' \ '--hold[Remain open after child process exit]' \
'-h[Prints help information]' \ '-h[Print help information]' \
'--help[Prints help information]' \ '--help[Print help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0 && ret=0
;; ;;
(help) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \ '--version[Print version information]' \
'--help[Prints help information]' \ '-h[Print help information]' \
'-V[Prints version information]' \ '--help[Print help information]' \
'--version[Prints version information]' \
&& ret=0 && ret=0
;; ;;
esac esac
@ -90,10 +87,6 @@ esac
;; ;;
(help) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0 && ret=0
;; ;;
esac esac
@ -104,37 +97,31 @@ esac
(( $+functions[_alacritty_commands] )) || (( $+functions[_alacritty_commands] )) ||
_alacritty_commands() { _alacritty_commands() {
local commands; commands=( local commands; commands=(
"msg:Available socket messages" \ 'msg:Send a message to the Alacritty socket' \
"help:Prints this message or the help of the given subcommand(s)" \ 'help:Print this message or the help of the given subcommand(s)' \
) )
_describe -t commands 'alacritty commands' commands "$@" _describe -t commands 'alacritty commands' commands "$@"
} }
(( $+functions[_alacritty__msg__create-window_commands] )) || (( $+functions[_alacritty__msg__create-window_commands] )) ||
_alacritty__msg__create-window_commands() { _alacritty__msg__create-window_commands() {
local commands; commands=( local commands; commands=()
)
_describe -t commands 'alacritty msg create-window commands' commands "$@" _describe -t commands 'alacritty msg create-window commands' commands "$@"
} }
(( $+functions[_alacritty__help_commands] )) || (( $+functions[_alacritty__help_commands] )) ||
_alacritty__help_commands() { _alacritty__help_commands() {
local commands; commands=( local commands; commands=()
)
_describe -t commands 'alacritty help commands' commands "$@" _describe -t commands 'alacritty help commands' commands "$@"
} }
(( $+functions[_alacritty__msg__help_commands] )) || (( $+functions[_alacritty__msg__help_commands] )) ||
_alacritty__msg__help_commands() { _alacritty__msg__help_commands() {
local commands; commands=( local commands; commands=()
)
_describe -t commands 'alacritty msg help commands' commands "$@" _describe -t commands 'alacritty msg help commands' commands "$@"
} }
(( $+functions[_alacritty__msg_commands] )) || (( $+functions[_alacritty__msg_commands] )) ||
_alacritty__msg_commands() { _alacritty__msg_commands() {
local commands; commands=( local commands; commands=(
"create-window:Create a new window in the same Alacritty process" \ 'create-window:Create a new window in the same Alacritty process' \
"help:Prints this message or the help of the given subcommand(s)" \ 'help:Print this message or the help of the given subcommand(s)' \
) )
_describe -t commands 'alacritty msg commands' commands "$@" _describe -t commands 'alacritty msg commands' commands "$@"
} }

View File

@ -9,10 +9,9 @@ _alacritty() {
for i in ${COMP_WORDS[@]} for i in ${COMP_WORDS[@]}
do do
case "${i}" in case "${i}" in
alacritty) "$1")
cmd="alacritty" cmd="alacritty"
;; ;;
create-window) create-window)
cmd+="__create__window" cmd+="__create__window"
;; ;;
@ -29,13 +28,12 @@ _alacritty() {
case "${cmd}" in case "${cmd}" in
alacritty) alacritty)
opts=" -q -v -h -V -o -e -t --print-events --ref-test --hold --help --version --embed --config-file --socket --option --working-directory --command --title --class msg help" 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"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
--embed) --embed)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
@ -52,7 +50,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-o) -o)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -64,7 +62,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-e) -e)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -72,7 +70,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-t) -t)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -87,15 +85,13 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
alacritty__help) alacritty__help)
opts=" -h -V --help --version " opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
*) *)
COMPREPLY=() COMPREPLY=()
;; ;;
@ -104,18 +100,17 @@ _alacritty() {
return 0 return 0
;; ;;
alacritty__msg) alacritty__msg)
opts=" -h -V -s --help --version --socket create-window help" opts="-s -h --socket --help create-window help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
--socket) --socket)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-s) -s)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -127,13 +122,12 @@ _alacritty() {
return 0 return 0
;; ;;
alacritty__msg__create__window) alacritty__msg__create__window)
opts=" -h -V -e -t --hold --help --version --working-directory --command --title --class " opts="-e -t -h --version --working-directory --hold --command --title --class --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
--working-directory) --working-directory)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
@ -142,7 +136,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-e) -e)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -150,7 +144,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
-t) -t)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
@ -166,13 +160,12 @@ _alacritty() {
return 0 return 0
;; ;;
alacritty__msg__help) alacritty__msg__help)
opts=" -h -V --help --version " opts="-h --version --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
*) *)
COMPREPLY=() COMPREPLY=()
;; ;;

View File

@ -1,33 +1,30 @@
complete -c alacritty -n "__fish_use_subcommand" -l embed -d 'Defines the X11 window ID (as a decimal integer) to embed Alacritty within' complete -c alacritty -n "__fish_use_subcommand" -l embed -d 'Defines the X11 window ID (as a decimal integer) to embed Alacritty within' -r
complete -c alacritty -n "__fish_use_subcommand" -l config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]' complete -c alacritty -n "__fish_use_subcommand" -l config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]' -r
complete -c alacritty -n "__fish_use_subcommand" -l socket -d 'Path for IPC socket creation' complete -c alacritty -n "__fish_use_subcommand" -l socket -d 'Path for IPC socket creation' -r
complete -c alacritty -n "__fish_use_subcommand" -s o -l option -d 'Override configuration file options [example: cursor.style=Beam]' complete -c alacritty -n "__fish_use_subcommand" -s o -l option -d 'Override configuration file options [example: cursor.style=Beam]' -r
complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start the shell in the specified working directory' complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start the shell in the specified working directory' -r
complete -c alacritty -n "__fish_use_subcommand" -s e -l command -d 'Command and args to execute (must be last argument)' 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]' 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]' 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 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" -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 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" -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" -l hold -d 'Remain open after child process exit'
complete -c alacritty -n "__fish_use_subcommand" -s h -l help -d 'Prints help information' 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" -s V -l version -d 'Prints version information' 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_use_subcommand" -f -a "msg" -d 'Available socket messages' complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from help" -s s -l socket -d 'IPC socket connection path override' -r
complete -c alacritty -n "__fish_use_subcommand" -f -a "help" -d 'Prints 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 help" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_seen_subcommand_from msg" -s s -l socket -d 'IPC socket connection path override' complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; 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" -s h -l help -d 'Prints 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 help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_seen_subcommand_from msg" -s V -l version -d 'Prints version information' complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -l working-directory -d 'Start the shell in the specified working directory' -r
complete -c alacritty -n "__fish_seen_subcommand_from msg" -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 create-window" -s e -l command -d 'Command and args to execute (must be last argument)' -r
complete -c alacritty -n "__fish_seen_subcommand_from msg" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)' 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 create-window" -l working-directory -d 'Start the shell in the specified working directory' 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 create-window" -s e -l command -d 'Command and args to execute (must be last argument)' complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from create-window" -l version -d 'Print version information'
complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s t -l title -d 'Defines the window title [default: Alacritty]' 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 create-window" -l class -d 'Defines window class/app_id on X11/Wayland [default: Alacritty]' 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 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 help" -l version -d 'Print version information'
complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s h -l help -d 'Prints help information' complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s V -l version -d 'Prints version information'
complete -c alacritty -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c alacritty -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c alacritty -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c alacritty -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'