UninstallShellCompletion uninstalls shell completion for the detected shell
(verbose bool)
| 383 | |
| 384 | // UninstallShellCompletion uninstalls shell completion for the detected shell |
| 385 | func UninstallShellCompletion(verbose bool) error { |
| 386 | shellCompletionLog.Print("Starting shell completion uninstallation") |
| 387 | |
| 388 | shellType := DetectShell() |
| 389 | shellCompletionLog.Printf("Detected shell type: %s", shellType) |
| 390 | |
| 391 | if shellType == ShellUnknown { |
| 392 | return errors.New("could not detect shell type. Please uninstall completions manually") |
| 393 | } |
| 394 | |
| 395 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Detected shell: %s", shellType))) |
| 396 | |
| 397 | switch shellType { |
| 398 | case ShellBash: |
| 399 | return uninstallBashCompletion(verbose) |
| 400 | case ShellZsh: |
| 401 | return uninstallZshCompletion(verbose) |
| 402 | case ShellFish: |
| 403 | return uninstallFishCompletion(verbose) |
| 404 | case ShellPowerShell: |
| 405 | return uninstallPowerShellCompletion(verbose) |
| 406 | default: |
| 407 | return fmt.Errorf("shell completion not supported for: %s", shellType) |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | // uninstallBashCompletion uninstalls bash completion |
| 412 | func uninstallBashCompletion(verbose bool) error { |