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 } => { Commands::Completions { shell } => {
let mut app = Cli::into_app(); let mut app = Cli::into_app();
if shell == "bash" { match shell.as_str() {
print_completions(Shell::Bash, &mut app); "bash" => print_completions(Shell::Bash, &mut app),
} else if shell == "zsh" { "zsh" => print_completions(Shell::Zsh, &mut app),
print_completions(Shell::Zsh, &mut app); "fish" => print_completions(Shell::Fish, &mut app),
} else if shell == "fish" { "powershell" => print_completions(Shell::PowerShell, &mut app),
print_completions(Shell::Fish, &mut app);
} else if shell == "powershell" { _ => error!("Completions to shell `{shell}`, not found!")
print_completions(Shell::PowerShell, &mut app);
} else {
error!("Completions to shell `{shell}`, not found!")
} }
} }
} }