MCPcopy Create free account
hub / github.com/Effect-TS/effect / getBashCompletions

Function getBashCompletions

packages/cli/src/internal/primitive.ts:626–666  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

624
625/** @internal */
626export const getBashCompletions = (self: Instruction): string => {
627 switch (self._tag) {
628 case "Bool": {
629 return "\"${cur}\""
630 }
631 case "DateTime":
632 case "Float":
633 case "Integer":
634 case "Secret":
635 case "Redacted":
636 case "Text": {
637 return "$(compgen -f \"${cur}\")"
638 }
639 case "Path": {
640 switch (self.pathType) {
641 case "file": {
642 return self.pathExists === "yes" || self.pathExists === "either"
643 ? "$(compgen -f \"${cur}\")"
644 : ""
645 }
646 case "directory": {
647 return self.pathExists === "yes" || self.pathExists === "either"
648 ? "$(compgen -d \"${cur}\")"
649 : ""
650 }
651 case "either": {
652 return self.pathExists === "yes" || self.pathExists === "either"
653 ? "$(compgen -f \"${cur}\")"
654 : ""
655 }
656 }
657 }
658 case "Choice": {
659 const choices = pipe(
660 Arr.map(self.alternatives, ([choice]) => choice),
661 Arr.join(",")
662 )
663 return `$(compgen -W "${choices}" -- "\${cur}")`
664 }
665 }
666}
667
668/** @internal */
669export const getFishCompletions = (self: Instruction): Array<string> => {

Callers

nothing calls this directly

Calls 3

pipeFunction · 0.70
mapMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected