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

Function getFishCompletions

packages/cli/src/internal/args.ts:1034–1067  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

1032
1033/** @internal */
1034export const getFishCompletions = (self: Instruction): Array<string> => {
1035 switch (self._tag) {
1036 case "Empty": {
1037 return Arr.empty()
1038 }
1039 case "Single": {
1040 const description = getShortDescription(self)
1041 return pipe(
1042 InternalPrimitive.getFishCompletions(
1043 self.primitiveType as InternalPrimitive.Instruction
1044 ),
1045 Arr.appendAll(
1046 description.length === 0
1047 ? Arr.empty()
1048 : Arr.of(`-d '${InternalCompletion.escapeSingleQuoted(description)}'`)
1049 ),
1050 Arr.join(" "),
1051 Arr.of
1052 )
1053 }
1054 case "Both": {
1055 return pipe(
1056 getFishCompletions(self.left as Instruction),
1057 Arr.appendAll(getFishCompletions(self.right as Instruction))
1058 )
1059 }
1060 case "Map":
1061 case "Variadic":
1062 case "WithDefault":
1063 case "WithFallbackConfig": {
1064 return getFishCompletions(self.args as Instruction)
1065 }
1066 }
1067}
1068
1069interface ZshCompletionState {
1070 readonly multiple: boolean

Callers

nothing calls this directly

Calls 4

getShortDescriptionFunction · 0.70
pipeFunction · 0.70
ofMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected