From ba152f53fc1d0a53a797c44efba2cdc58a9c19b7 Mon Sep 17 00:00:00 2001 From: Zykino Date: Tue, 30 Jun 2026 12:35:30 +0200 Subject: [PATCH] Fish completion delete session (#5317) * Add session completion for "delete-session" Close #5316 * Force default value for CARGO_TARGET_DIR Since we did not approved and maintain #2611 * Move `xtask run`'s specific output to stderr That way command output can be redirected without garbage e.g.: `cargo xtask run -- setup --generate-completion fish > ~/.config/fish/completions/zellij.fish` --------- Co-authored-by: Zykino <3809938+Zykino@users.noreply.github.com> --- .cargo/config.toml | 3 +++ CONTRIBUTING.md | 2 +- xtask/src/build.rs | 4 ++-- xtask/src/main.rs | 4 ++-- zellij-utils/assets/completions/comp.fish | 14 ++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f2455d453..7eeb0b9dd 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -8,3 +8,6 @@ make = "xtask deprecated" [target.x86_64-pc-windows-gnu] linker = "x86_64-w64-mingw32-gcc" + +[build] +target-dir = "target" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43c6d9124..6937ffe84 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ cargo xtask build cargo xtask test # Run Zellij (optionally with additional arguments) cargo xtask run -cargo xtask run -l strider +cargo xtask run -- -l strider # Run Clippy cargo xtask clippy # Install Zellij to some directory diff --git a/xtask/src/build.rs b/xtask/src/build.rs index b736897fc..f4977f719 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -38,10 +38,10 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> { .collect(); if !plugin_members.is_empty() { - println!(); + eprintln!(); let msg = ">> Building plugins"; crate::status(msg); - println!("{}", msg); + eprintln!("{}", msg); let mut base_cmd = cmd!(sh, "{cargo} build --target wasm32-wasip1"); if flags.release { diff --git a/xtask/src/main.rs b/xtask/src/main.rs index cb378b44d..3f4428727 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -146,7 +146,7 @@ fn main() -> anyhow::Result<()> { let elapsed = now.elapsed().as_secs(); status(&format!("xtask (done after {} s)", elapsed)); - println!("\n\n>> Command took {} s", elapsed); + eprintln!("\n\n>> Command took {} s", elapsed); Ok(()) } @@ -172,7 +172,7 @@ pub fn cargo() -> anyhow::Result { // Set terminal title to 'msg' pub fn status(msg: &str) { - print!("\u{1b}]0;{}\u{07}", msg); + eprint!("\u{1b}]0;{}\u{07}", msg); } fn deprecation_notice() -> anyhow::Result<()> { diff --git a/zellij-utils/assets/completions/comp.fish b/zellij-utils/assets/completions/comp.fish index 2dc3ff928..9c9015948 100644 --- a/zellij-utils/assets/completions/comp.fish +++ b/zellij-utils/assets/completions/comp.fish @@ -1,11 +1,13 @@ function __fish_complete_sessions zellij list-sessions --short --no-formatting 2>/dev/null end -complete -c zellij -n "__fish_seen_subcommand_from attach" -f -a "(__fish_complete_sessions)" -d "Session" -complete -c zellij -n "__fish_seen_subcommand_from a" -f -a "(__fish_complete_sessions)" -d "Session" -complete -c zellij -n "__fish_seen_subcommand_from kill-session" -f -a "(__fish_complete_sessions)" -d "Session" -complete -c zellij -n "__fish_seen_subcommand_from k" -f -a "(__fish_complete_sessions)" -d "Session" -complete -c zellij -n "__fish_seen_subcommand_from setup" -l "generate-completion" -x -a "bash elvish fish zsh powershell" -d "Shell" +complete -c zellij -n "__fish_seen_subcommand_from attach" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from a" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from kill-session" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from k" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from delete-session" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from d" -f -a "(__fish_complete_sessions)" -d Session +complete -c zellij -n "__fish_seen_subcommand_from setup" -l generate-completion -x -a "bash elvish fish zsh powershell" -d Shell function zr command zellij run --name "$argv" -- fish -c "$argv" end @@ -36,4 +38,4 @@ function zpipe command zellij pipe end end -complete -c zpipe -f -a "(__fish_complete_aliases)" -d "Zpipes" \ No newline at end of file +complete -c zpipe -f -a "(__fish_complete_aliases)" -d Zpipes