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

Function subcommandCompletions

packages/cli/src/internal/commandDescriptor.ts:1183–1197  ·  view source on GitHub ↗
(conditionals: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

1181 )
1182 )
1183 const subcommandCompletions = (conditionals: ReadonlyArray<string>) =>
1184 Arr.map(info.subcommands, ([name, subcommand]) => {
1185 const description = getShortDescription(subcommand)
1186 return pipe(
1187 baseTemplate,
1188 Arr.appendAll(conditionals),
1189 Arr.appendAll(Arr.make("-f", "-a", `"${name}"`)),
1190 Arr.appendAll(
1191 description.length === 0
1192 ? Arr.empty()
1193 : Arr.make("-d", `'${description}'`)
1194 ),
1195 Arr.join(" ")
1196 )
1197 })
1198 // If parent commands are empty, then the info is for the root command
1199 if (Arr.isEmptyReadonlyArray(info.parentCommands)) {
1200 const conditionals = Arr.make("-n", "\"__fish_use_subcommand\"")

Callers 1

Calls 5

getShortDescriptionFunction · 0.70
pipeFunction · 0.70
mapMethod · 0.65
makeMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected