diff options
| author | James Richter <daystar999964@gmail.com> | 2021-04-25 14:12:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-25 14:12:45 -0700 |
| commit | 20183b315d13c84e41ed0c59d6d2d1a6d17db17b (patch) | |
| tree | 3de8f3da78e13524a4143c579134aff2df89e1f5 /src | |
| parent | Requested Changes to 362: (diff) | |
| parent | Merge pull request #362 from SaintFenix/main (diff) | |
| download | sl0ppij-20183b315d13c84e41ed0c59d6d2d1a6d17db17b.tar.gz sl0ppij-20183b315d13c84e41ed0c59d6d2d1a6d17db17b.tar.xz sl0ppij-20183b315d13c84e41ed0c59d6d2d1a6d17db17b.zip | |
Merge pull request #1 from zellij-org/main
Catching up to Master:
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(); |
