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

Function subcommandCompletions

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

Source from the content-addressed store, hash-verified

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