| 667 | |
| 668 | /** @internal */ |
| 669 | export const getFishCompletions = (self: Instruction): Array<string> => { |
| 670 | switch (self._tag) { |
| 671 | case "Bool": { |
| 672 | return Arr.empty() |
| 673 | } |
| 674 | case "DateTime": |
| 675 | case "Float": |
| 676 | case "Integer": |
| 677 | case "Redacted": |
| 678 | case "Secret": |
| 679 | case "Text": { |
| 680 | return Arr.make("-r", "-f") |
| 681 | } |
| 682 | case "Path": { |
| 683 | switch (self.pathType) { |
| 684 | case "file": { |
| 685 | return self.pathExists === "yes" || self.pathExists === "either" |
| 686 | ? Arr.make("-r", "-F") |
| 687 | : Arr.make("-r") |
| 688 | } |
| 689 | case "directory": { |
| 690 | return self.pathExists === "yes" || self.pathExists === "either" |
| 691 | ? Arr.make( |
| 692 | "-r", |
| 693 | "-f", |
| 694 | "-a", |
| 695 | `"(__fish_complete_directories (commandline -ct))"` |
| 696 | ) |
| 697 | : Arr.make("-r") |
| 698 | } |
| 699 | case "either": { |
| 700 | return self.pathExists === "yes" || self.pathExists === "either" |
| 701 | ? Arr.make("-r", "-F") |
| 702 | : Arr.make("-r") |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | case "Choice": { |
| 707 | const choices = pipe( |
| 708 | Arr.map(self.alternatives, ([choice]) => `${choice}''`), |
| 709 | Arr.join(",") |
| 710 | ) |
| 711 | return Arr.make("-r", "-f", "-a", `"{${choices}}"`) |
| 712 | } |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | /** @internal */ |
| 717 | export const getZshCompletions = (self: Instruction): string => { |