MCPcopy Index your code
hub / github.com/Effect-TS/effect / getBashCompletions

Function getBashCompletions

packages/cli/src/internal/options.ts:2077–2111  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

2075
2076/** @internal */
2077export const getBashCompletions = (self: Instruction): ReadonlyArray<string> => {
2078 switch (self._tag) {
2079 case "Empty": {
2080 return Arr.empty()
2081 }
2082 case "Single": {
2083 const names = getNames(self)
2084 const cases = Arr.join(names, "|")
2085 const compgen = InternalPrimitive.getBashCompletions(
2086 self.primitiveType as InternalPrimitive.Instruction
2087 )
2088 return Arr.make(
2089 `${cases})`,
2090 ` COMPREPLY=( ${compgen} )`,
2091 ` return 0`,
2092 ` ;;`
2093 )
2094 }
2095 case "KeyValueMap":
2096 case "Variadic": {
2097 return getBashCompletions(self.argumentOption as Instruction)
2098 }
2099 case "Map":
2100 case "WithDefault":
2101 case "WithFallback": {
2102 return getBashCompletions(self.options as Instruction)
2103 }
2104 case "Both":
2105 case "OrElse": {
2106 const left = getBashCompletions(self.left as Instruction)
2107 const right = getBashCompletions(self.right as Instruction)
2108 return Arr.appendAll(left, right)
2109 }
2110 }
2111}
2112
2113/** @internal */
2114export const getFishCompletions = (self: Instruction): Array<string> => {

Callers

nothing calls this directly

Calls 3

getNamesFunction · 0.70
joinMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected