summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--Cargo.lock187
-rw-r--r--alacritty/Cargo.toml8
-rw-r--r--alacritty/src/cli.rs85
-rw-r--r--extra/completions/_alacritty93
-rw-r--r--extra/completions/alacritty.bash31
-rw-r--r--extra/completions/alacritty.fish53
7 files changed, 216 insertions, 245 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 397d5514..23a1da24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
+### Changed
+
+- The `--help` output was reworked with a new colorful syntax
+
## 0.10.0
### Packaging
diff --git a/Cargo.lock b/Cargo.lock
index e865e88e..be47ee94 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,6 +16,7 @@ dependencies = [
"alacritty_terminal",
"bitflags",
"clap",
+ "clap_complete",
"cocoa",
"copypasta",
"crossfont",
@@ -34,7 +35,6 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
- "structopt",
"time",
"unicode-width",
"wayland-client",
@@ -89,15 +89,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -177,17 +168,41 @@ dependencies = [
[[package]]
name = "clap"
-version = "2.34.0"
+version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+checksum = "17a98d95cbe8abdf3bfe1a2bd4aa7215700403b79a0eb03cbddb017a5824e186"
dependencies = [
- "ansi_term",
"atty",
"bitflags",
- "strsim 0.8.0",
+ "clap_derive",
+ "indexmap",
+ "lazy_static",
+ "os_str_bytes",
+ "strsim",
+ "termcolor",
"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]]
@@ -404,7 +419,7 @@ dependencies = [
"ident_case",
"proc-macro2",
"quote",
- "strsim 0.10.0",
+ "strsim",
"syn",
]
@@ -420,17 +435,6 @@ dependencies = [
]
[[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]]
name = "dirs"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -725,12 +729,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
-version = "0.3.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
+checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
@@ -855,9 +856,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
-version = "0.2.109"
+version = "0.2.112"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01"
+checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
[[package]]
name = "libloading"
@@ -1141,19 +1142,18 @@ dependencies = [
[[package]]
name = "num_enum"
-version = "0.5.4"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f"
+checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
dependencies = [
- "derivative",
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
-version = "0.5.4"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9"
+checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -1192,9 +1192,18 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.8.0"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
+
+[[package]]
+name = "os_str_bytes"
+version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
+dependencies = [
+ "memchr",
+]
[[package]]
name = "osmesa-sys"
@@ -1289,18 +1298,27 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.33"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
+checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid",
]
[[package]]
+name = "quick-xml"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
name = "quote"
-version = "1.0.10"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
+checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
dependencies = [
"proc-macro2",
]
@@ -1350,9 +1368,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "ryu"
-version = "1.0.7"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "254df5081ce98661a883445175e52efe99d1cb2a5552891d965d2f5d0cad1c16"
+checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]]
name = "same-file"
@@ -1451,9 +1469,9 @@ dependencies = [
[[package]]
name = "signal-hook"
-version = "0.3.12"
+version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c35dfd12afb7828318348b8c408383cf5071a086c1d4ab1c0f9840ec92dbb922"
+checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
dependencies = [
"libc",
"signal-hook-registry",
@@ -1529,59 +1547,35 @@ checksum = "be6c3f39c37a4283ee4b43d1311c828f2e1fb0541e76ea0cb1a2abd9ef2f5b3b"
[[package]]
name = "strsim"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-
-[[package]]
-name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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"
+name = "syn"
+version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
+checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b"
dependencies = [
- "heck",
- "proc-macro-error",
"proc-macro2",
"quote",
- "syn",
+ "unicode-xid",
]
[[package]]
-name = "syn"
-version = "1.0.82"
+name = "termcolor"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
+checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
+ "winapi-util",
]
[[package]]
name = "textwrap"
-version = "0.11.0"
+version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
+checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]]
name = "thiserror"
@@ -1623,12 +1617,6 @@ dependencies = [
]
[[package]]
-name = "unicode-segmentation"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
-
-[[package]]
name = "unicode-width"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1647,16 +1635,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
[[package]]
-name = "vec_map"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-
-[[package]]
name = "version_check"
-version = "0.9.3"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vswhom"
@@ -1970,9 +1952,9 @@ dependencies = [
[[package]]
name = "x11-clipboard"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b397ace6e980510de59a4fe3d4c758dffab231d6d747ce9fa1aba6b6035d5f32"
+checksum = "473068b7b80ac86a18328824f1054e5e007898c47b5bbc281bd7abe32bc3653c"
dependencies = [
"xcb",
]
@@ -1990,12 +1972,13 @@ dependencies = [
[[package]]
name = "xcb"
-version = "0.9.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6"
+checksum = "771e2b996df720cd1c6dd9ff90f62d91698fd3610cc078388d0564bdd6622a9c"
dependencies = [
"libc",
"log",
+ "quick-xml",
]
[[package]]
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index d64f3d3f..26523e1c 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -19,7 +19,7 @@ path = "../alacritty_config_derive"
version = "0.1.0"
[dependencies]
-structopt = "0.3.22"
+clap = { version = "3.0.0", features = ["derive"] }
log = { version = "0.4", features = ["std", "serde"] }
time = "0.1.40"
fnv = "1"
@@ -36,12 +36,12 @@ unicode-width = "0.1"
bitflags = "1"
dirs = "3.0.1"
-[dev-dependencies]
-clap = "2.33.3"
-
[build-dependencies]
gl_generator = "0.14.0"
+[dev-dependencies]
+clap_complete = "3.0.0"
+
[target.'cfg(not(windows))'.dependencies]
xdg = "2.4.0"
diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs
index 4c8a307a..a53c6ef3 100644
--- a/alacritty/src/cli.rs
+++ b/alacritty/src/cli.rs
@@ -1,10 +1,12 @@
use std::cmp::max;
use std::path::PathBuf;
+#[cfg(unix)]
+use clap::Subcommand;
+use clap::{Args, Parser};
use log::{self, error, LevelFilter};
use serde::{Deserialize, Serialize};
use serde_yaml::Value;
-use structopt::StructOpt;
use alacritty_terminal::config::{Program, PtyConfig};
@@ -12,70 +14,70 @@ use crate::config::window::{Class, Identity, DEFAULT_NAME};
use crate::config::{serde_utils, UiConfig};
/// CLI options for the main Alacritty executable.
-#[derive(StructOpt, Default, Debug)]
-#[structopt(author, about, version = env!("VERSION"))]
+#[derive(Parser, Default, Debug)]
+#[clap(author, about, version = env!("VERSION"))]
pub struct Options {
/// Print all events to stdout.
- #[structopt(long)]
+ #[clap(long)]
pub print_events: bool,
/// Generates ref test.
- #[structopt(long)]
+ #[clap(long)]
pub ref_test: bool,
/// Defines the X11 window ID (as a decimal integer) to embed Alacritty within.
- #[structopt(long)]
+ #[clap(long)]
pub embed: Option<String>,
/// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml].
#[cfg(not(any(target_os = "macos", windows)))]
- #[structopt(long)]
+ #[clap(long)]
pub config_file: Option<PathBuf>,
/// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml].
#[cfg(windows)]
- #[structopt(long)]
+ #[clap(long)]
pub config_file: Option<PathBuf>,
/// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml].
#[cfg(target_os = "macos")]
- #[structopt(long)]
+ #[clap(long)]
pub config_file: Option<PathBuf>,
/// Path for IPC socket creation.
#[cfg(unix)]
- #[structopt(long)]
+ #[clap(long)]
pub socket: Option<PathBuf>,
/// 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,
/// 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,
/// Override configuration file options [example: cursor.style=Beam].
- #[structopt(short = "o", long)]
+ #[clap(short = 'o', long, multiple_values = true)]
option: Vec<String>,
/// CLI options for config overrides.
- #[structopt(skip)]
+ #[clap(skip)]
pub config_options: Value,
- /// Options which could be passed via IPC.
- #[structopt(flatten)]
+ /// Options which can be passed via IPC.
+ #[clap(flatten)]
pub window_options: WindowOptions,
/// Subcommand passed to the CLI.
#[cfg(unix)]
- #[structopt(subcommand)]
+ #[clap(subcommand)]
pub subcommands: Option<Subcommands>,
}
impl Options {
pub fn new() -> Self {
- let mut options = Self::from_args();
+ let mut options = Self::parse();
// Convert `--option` flags into serde `Value`.
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.
-#[derive(Serialize, Deserialize, StructOpt, Default, Debug, Clone, PartialEq)]
+#[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq)]
pub struct TerminalOptions {
/// Start the shell in the specified working directory.
- #[structopt(long)]
+ #[clap(long)]
pub working_directory: Option<PathBuf>,
/// Remain open after child process exit.
- #[structopt(long)]
+ #[clap(long)]
pub hold: bool,
/// 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>,
}
@@ -223,14 +225,14 @@ impl From<TerminalOptions> for PtyConfig {
}
/// 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 {
/// Defines the window title [default: Alacritty].
- #[structopt(short, long)]
+ #[clap(short, long)]
pub title: Option<String>,
/// 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>,
}
@@ -248,40 +250,40 @@ impl WindowIdentity {
/// Available CLI subcommands.
#[cfg(unix)]
-#[derive(StructOpt, Debug)]
+#[derive(Subcommand, Debug)]
pub enum Subcommands {
Msg(MessageOptions),
}
/// Send a message to the Alacritty socket.
#[cfg(unix)]
-#[derive(StructOpt, Debug)]
+#[derive(Args, Debug)]
pub struct MessageOptions {
/// IPC socket connection path override.
- #[structopt(long, short)]
+ #[clap(long, short)]
pub socket: Option<PathBuf>,
/// Message which should be sent.
- #[structopt(subcommand)]
+ #[clap(subcommand)]
pub message: SocketMessage,
}
/// Available socket messages.
#[cfg(unix)]
-#[derive(StructOpt, Serialize, Deserialize, Debug, Clone, PartialEq)]
+#[derive(Subcommand, Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum SocketMessage {
/// Create a new window in the same Alacritty process.
CreateWindow(WindowOptions),
}
/// 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 {
/// Terminal options which can be passed via IPC.
- #[structopt(flatten)]
+ #[clap(flatten)]
pub terminal_options: TerminalOptions,
- #[structopt(flatten)]
+ #[clap(flatten)]
/// Window options which could be passed via IPC.
pub window_identity: WindowIdentity,
}
@@ -296,7 +298,9 @@ mod tests {
use std::io::Read;
#[cfg(target_os = "linux")]
- use clap::Shell;
+ use clap::IntoApp;
+ #[cfg(target_os = "linux")]
+ use clap_complete::Shell;
use serde_yaml::mapping::Mapping;
#[test]
@@ -392,7 +396,7 @@ mod tests {
#[cfg(target_os = "linux")]
#[test]
fn completions() {
- let mut clap = Options::clap();
+ let mut clap = Options::into_app();
for (shell, file) in &[
(Shell::Bash, "alacritty.bash"),
@@ -400,7 +404,7 @@ mod tests {
(Shell::Zsh, "_alacritty"),
] {
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 mut completion = String::new();
@@ -412,8 +416,11 @@ mod tests {
// NOTE: Use this to generate new completions.
//
- // clap.gen_completions("alacritty", Shell::Bash, "../extra/completions/");
- // clap.gen_completions("alacritty", Shell::Fish, "../extra/completions/");
- // clap.gen_completions("alacritty", Shell::Zsh, "../extra/completions/");
+ // let mut file = File::create("../extra/completions/alacritty.bash").unwrap();
+ // clap_complete::generate(Shell::Bash, &mut clap, "alacritty", &mut file);
+ // 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);
}
}
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty
index ad93e6bc..4f482236 100644
--- a/extra/completions/_alacritty
+++ b/extra/completions/_alacritty
@@ -15,26 +15,26 @@ _alacritty() {
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
-'--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]' \
-'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]' \
-'--socket=[Path for IPC socket creation]' \
-'*-o+[Override configuration file options \[example: cursor.style=Beam\]]' \
-'*--option=[Override configuration file options \[example: cursor.style=Beam\]]' \
-'--working-directory=[Start the shell in the specified working directory]' \
-'*-e+[Command and args to execute (must be last argument)]' \
-'*--command=[Command and args to execute (must be last argument)]' \
-'-t+[Defines the window title \[default: Alacritty\]]' \
-'--title=[Defines the window title \[default: Alacritty\]]' \
-'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]' \
+'--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: ' \
+'--socket=[Path for IPC socket creation]:SOCKET: ' \
+'*-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: ' \
+'*-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\]]: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]' \
'--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[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
":: :_alacritty_commands" \
"*::: :->alacritty" \
&& ret=0
@@ -46,16 +46,15 @@ _alacritty() {
case $line[1] in
(msg)
_arguments "${_arguments_options[@]}" \
-'-s+[IPC socket connection path override]' \
-'--socket=[IPC socket connection path override]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
+'-s+[IPC socket connection path override]:SOCKET: ' \
+'--socket=[IPC socket connection path override]:SOCKET: ' \
+'-h[Print help information]' \
+'--help[Print help information]' \
":: :_alacritty__msg_commands" \
"*::: :->msg" \
&& ret=0
-case $state in
+
+ case $state in
(msg)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
@@ -63,25 +62,23 @@ case $state in
case $line[1] in
(create-window)
_arguments "${_arguments_options[@]}" \
-'--working-directory=[Start the shell in the specified working directory]' \
-'*-e+[Command and args to execute (must be last argument)]' \
-'*--command=[Command and args to execute (must be last argument)]' \
-'-t+[Defines the window title \[default: Alacritty\]]' \
-'--title=[Defines the window title \[default: Alacritty\]]' \
-'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]' \
+'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \
+'*-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\]]:instance> | <instance>,<general: ' \
+'--version[Print version information]' \
'--hold[Remain open after child process exit]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
+'-h[Print help information]' \
+'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
+'--version[Print version information]' \
+'-h[Print help information]' \
+'--help[Print help information]' \
&& ret=0
;;
esac
@@ -90,10 +87,6 @@ esac
;;
(help)
_arguments "${_arguments_options[@]}" \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
&& ret=0
;;
esac
@@ -104,37 +97,31 @@ esac
(( $+functions[_alacritty_commands] )) ||
_alacritty_commands() {
local commands; commands=(
- "msg:Available socket messages" \
-"help:Prints this message or the help of the given subcommand(s)" \
+'msg:Send a message to the Alacritty socket' \
+'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty commands' commands "$@"
}
(( $+functions[_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 "$@"
}
(( $+functions[_alacritty__help_commands] )) ||
_alacritty__help_commands() {
- local commands; commands=(
-
- )
+ local commands; commands=()
_describe -t commands 'alacritty help commands' commands "$@"
}
(( $+functions[_alacritty__msg__help_commands] )) ||
_alacritty__msg__help_commands() {
- local commands; commands=(
-
- )
+ local commands; commands=()
_describe -t commands 'alacritty msg help commands' commands "$@"
}
(( $+functions[_alacritty__msg_commands] )) ||
_alacritty__msg_commands() {
local commands; commands=(
- "create-window:Create a new window in the same Alacritty process" \
-"help:Prints this message or the help of the given subcommand(s)" \
+'create-window:Create a new window in the same Alacritty process' \
+'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty msg commands' commands "$@"
}
diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash
index cc1c1f42..fcdfc6e8 100644
--- a/extra/completions/alacritty.bash
+++ b/extra/completions/alacritty.bash
@@ -9,10 +9,9 @@ _alacritty() {
for i in ${COMP_WORDS[@]}
do
case "${i}" in
- alacritty)
+ "$1")
cmd="alacritty"
;;
-
create-window)
cmd+="__create__window"
;;
@@ -29,13 +28,12 @@ _alacritty() {
case "${cmd}" in
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
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-
--embed)
COMPREPLY=($(compgen -f "${cur}"))
return 0
@@ -52,7 +50,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -o)
+ -o)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -64,7 +62,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -e)
+ -e)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -72,7 +70,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -t)
+ -t)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -87,15 +85,13 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
-
alacritty__help)
- opts=" -h -V --help --version "
+ opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-
*)
COMPREPLY=()
;;
@@ -104,18 +100,17 @@ _alacritty() {
return 0
;;
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
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-
--socket)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -s)
+ -s)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -127,13 +122,12 @@ _alacritty() {
return 0
;;
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
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-
--working-directory)
COMPREPLY=($(compgen -f "${cur}"))
return 0
@@ -142,7 +136,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -e)
+ -e)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -150,7 +144,7 @@ _alacritty() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
- -t)
+ -t)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
@@ -166,13 +160,12 @@ _alacritty() {
return 0
;;
alacritty__msg__help)
- opts=" -h -V --help --version "
+ opts="-h --version --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-
*)
COMPREPLY=()
;;
diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish
index a94a81d3..0ad2fd27 100644
--- a/extra/completions/alacritty.fish
+++ b/extra/completions/alacritty.fish
@@ -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 config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]'
-complete -c alacritty -n "__fish_use_subcommand" -l socket -d 'Path for IPC socket creation'
-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" -l working-directory -d 'Start the shell in the specified working directory'
-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 t -l title -d 'Defines the window title [default: Alacritty]'
-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 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]' -r
+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]' -r
+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)' -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 'Prints help information'
-complete -c alacritty -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
-complete -c alacritty -n "__fish_use_subcommand" -f -a "msg" -d 'Available socket messages'
-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" -s s -l socket -d 'IPC socket connection path override'
-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" -s V -l version -d 'Prints version information'
-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" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
-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 create-window" -s e -l command -d 'Command and args to execute (must be last argument)'
-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 create-window" -l class -d 'Defines window class/app_id on X11/Wayland [default: Alacritty]'
-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 create-window" -s h -l help -d 'Prints 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'
+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 help" -s s -l socket -d 'IPC socket connection path override' -r
+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; 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; 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; 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; 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; 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 version -d 'Print version information'
+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 help" -l version -d 'Print version information'
+complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'