fixup! Add subcommand to generate completions
This commit is contained in:
parent
9aca589167
commit
49429688cf
2 changed files with 7 additions and 10 deletions
|
|
@ -53,8 +53,5 @@ pub enum ConfigCli {
|
||||||
},
|
},
|
||||||
|
|
||||||
#[structopt(name = "generate-completion")]
|
#[structopt(name = "generate-completion")]
|
||||||
GenerateCompletion {
|
GenerateCompletion { shell: String },
|
||||||
shell: String,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -47,15 +47,15 @@ pub fn main() {
|
||||||
stream.write_all(&api_command).unwrap();
|
stream.write_all(&api_command).unwrap();
|
||||||
} else if let Some(crate::cli::ConfigCli::GenerateCompletion { shell }) = opts.option {
|
} else if let Some(crate::cli::ConfigCli::GenerateCompletion { shell }) = opts.option {
|
||||||
let shell = match shell.as_ref() {
|
let shell = match shell.as_ref() {
|
||||||
"bash" => structopt::clap::Shell::Bash,
|
"bash" => structopt::clap::Shell::Bash,
|
||||||
"fish" => structopt::clap::Shell::Fish,
|
"fish" => structopt::clap::Shell::Fish,
|
||||||
"zsh" => structopt::clap::Shell::Zsh,
|
"zsh" => structopt::clap::Shell::Zsh,
|
||||||
"powerShell" => structopt::clap::Shell::PowerShell,
|
"powerShell" => structopt::clap::Shell::PowerShell,
|
||||||
"elvish" => structopt::clap::Shell::Elvish,
|
"elvish" => structopt::clap::Shell::Elvish,
|
||||||
other => {
|
other => {
|
||||||
eprintln!("Unsupported shell: {}", other);
|
eprintln!("Unsupported shell: {}", other);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
let mut out = std::io::stdout();
|
let mut out = std::io::stdout();
|
||||||
CliArgs::clap().gen_completions_to("zellij", shell, &mut out);
|
CliArgs::clap().gen_completions_to("zellij", shell, &mut out);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue