summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2022-03-05 16:23:51 +0100
committerGitHub <noreply@github.com>2022-03-05 16:23:51 +0100
commite2ce26121072adb8e4632f1f7de29a06f7e0662b (patch)
treef4917f7570c8f8dcf1314634c22c34b31566bc5e /zellij-utils/src
parentbe022e212f6e1d4af9f66c49c1cee51475f529ae (diff)
add(comp): dynamic completions for fish (#1176)
And infrastructure to make it possible to add more dynamic completions for different shells in the future. eg: ``` zellij attach [completes-active-sessions] zellij kill-session [completes-active-sessions] ``` fixes: #1030
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/setup.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs
index 565e72c9d..0912e016b 100644
--- a/zellij-utils/src/setup.rs
+++ b/zellij-utils/src/setup.rs
@@ -109,6 +109,12 @@ pub const NO_STATUS_LAYOUT: &[u8] = include_bytes!(concat!(
"assets/layouts/disable-status-bar.yaml"
));
+pub const FISH_EXTRA_COMPLETION: &[u8] = include_bytes!(concat!(
+ env!("CARGO_MANIFEST_DIR"),
+ "/",
+ "assets/completions/comp.fish"
+));
+
pub fn dump_default_config() -> std::io::Result<()> {
dump_asset(DEFAULT_CONFIG)
}
@@ -387,6 +393,17 @@ impl Setup {
};
let mut out = std::io::stdout();
clap_complete::generate(shell, &mut CliArgs::into_app(), "zellij", &mut out);
+ // add shell dependent extra completion
+ match shell {
+ Shell::Bash => {}
+ Shell::Elvish => {}
+ Shell::Fish => {
+ let _ = out.write_all(&FISH_EXTRA_COMPLETION);
+ }
+ Shell::PowerShell => {}
+ Shell::Zsh => {}
+ _ => {}
+ };
}
}