cli completions use match instead of if

This commit is contained in:
MedzikUser 2022-01-25 18:25:30 +01:00
parent bd3ef20a7f
commit 62531904f9
1 changed files with 7 additions and 10 deletions

View File

@ -76,16 +76,13 @@ pub async fn parse(client: ImgurHandle) {
Commands::Completions { shell } => {
let mut app = Cli::into_app();
if shell == "bash" {
print_completions(Shell::Bash, &mut app);
} else if shell == "zsh" {
print_completions(Shell::Zsh, &mut app);
} else if shell == "fish" {
print_completions(Shell::Fish, &mut app);
} else if shell == "powershell" {
print_completions(Shell::PowerShell, &mut app);
} else {
error!("Completions to shell `{shell}`, not found!")
match shell.as_str() {
"bash" => print_completions(Shell::Bash, &mut app),
"zsh" => print_completions(Shell::Zsh, &mut app),
"fish" => print_completions(Shell::Fish, &mut app),
"powershell" => print_completions(Shell::PowerShell, &mut app),
_ => error!("Completions to shell `{shell}`, not found!")
}
}
}