uninstallFishCompletion uninstalls fish completion
(verbose bool)
| 501 | |
| 502 | // uninstallFishCompletion uninstalls fish completion |
| 503 | func uninstallFishCompletion(verbose bool) error { |
| 504 | shellCompletionLog.Print("Uninstalling fish completion") |
| 505 | |
| 506 | homeDir, err := os.UserHomeDir() |
| 507 | if err != nil { |
| 508 | return fmt.Errorf("failed to get home directory: %w", err) |
| 509 | } |
| 510 | |
| 511 | completionPath := filepath.Join(homeDir, ".config", "fish", "completions", "gh-aw.fish") |
| 512 | |
| 513 | if _, err := os.Stat(completionPath); err != nil { |
| 514 | return fmt.Errorf("no fish completion file found at: %s", completionPath) |
| 515 | } |
| 516 | |
| 517 | shellCompletionLog.Printf("Found completion file at: %s", completionPath) |
| 518 | |
| 519 | if err := os.Remove(completionPath); err != nil { |
| 520 | return fmt.Errorf("failed to remove completion file: %w", err) |
| 521 | } |
| 522 | |
| 523 | fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Removed fish completion from: "+completionPath)) |
| 524 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Fish will automatically detect the removal on next shell start")) |
| 525 | |
| 526 | return nil |
| 527 | } |
| 528 | |
| 529 | // uninstallPowerShellCompletion uninstalls PowerShell completion |
| 530 | func uninstallPowerShellCompletion(verbose bool) error { |