diff options
| author | fenix <Daystar999964@gmail.com> | 2021-04-27 20:01:53 -0700 |
|---|---|---|
| committer | fenix <Daystar999964@gmail.com> | 2021-04-27 20:01:53 -0700 |
| commit | 72890b966e7225626106d399452c2bdfbe5b2d33 (patch) | |
| tree | 81a88c9c86cbf19a7dae0d47fbf589dcc5bb5c59 /src | |
| parent | Added Screen-overview.yaml & Screen.nonfunctional.txt (diff) | |
| parent | Merge pull request #1 from zellij-org/main (diff) | |
| download | sl0ppij-72890b966e7225626106d399452c2bdfbe5b2d33.tar.gz sl0ppij-72890b966e7225626106d399452c2bdfbe5b2d33.tar.xz sl0ppij-72890b966e7225626106d399452c2bdfbe5b2d33.zip | |
Merge remote-tracking branch 'origin/main' into main
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 14 |
2 files changed, 17 insertions, 0 deletions
@@ -51,4 +51,7 @@ pub enum ConfigCli { /// Disables loading of configuration file at default location clean: bool, }, + + #[structopt(name = "generate-completion")] + GenerateCompletion { shell: String }, } diff --git a/src/main.rs b/src/main.rs index ec249e8a..8da85c87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,6 +45,20 @@ pub fn main() { let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap(); stream.write_all(&api_command).unwrap(); + } else if let Some(crate::cli::ConfigCli::GenerateCompletion { shell }) = opts.option { + let shell = match shell.as_ref() { + "bash" => structopt::clap::Shell::Bash, + "fish" => structopt::clap::Shell::Fish, + "zsh" => structopt::clap::Shell::Zsh, + "powerShell" => structopt::clap::Shell::PowerShell, + "elvish" => structopt::clap::Shell::Elvish, + other => { + eprintln!("Unsupported shell: {}", other); + std::process::exit(1); + } + }; + let mut out = std::io::stdout(); + CliArgs::clap().gen_completions_to("zellij", shell, &mut out); } else { let os_input = get_os_input(); atomic_create_dir(ZELLIJ_TMP_DIR).unwrap(); |
