MCPcopy Create free account
hub / github.com/Noumena-Network/code / getCommandOptions

Function getCommandOptions

src/cli/handlers/ant.ts:280–309  ·  view source on GitHub ↗
(command: CommanderCommand)

Source from the content-addressed store, hash-verified

278}
279
280function getCommandOptions(command: CommanderCommand): {
281 options: string[]
282 valueOptions: string[]
283} {
284 const options = new Set<string>(['-h', '--help'])
285 const valueOptions = new Set<string>()
286
287 for (const option of command.options as CommanderOption[]) {
288 if (option.hidden) {
289 continue
290 }
291 if (option.short) {
292 options.add(option.short)
293 if (option.required || option.optional) {
294 valueOptions.add(option.short)
295 }
296 }
297 if (option.long) {
298 options.add(option.long)
299 if (option.required || option.optional) {
300 valueOptions.add(option.long)
301 }
302 }
303 }
304
305 return {
306 options: uniqSorted(options),
307 valueOptions: uniqSorted(valueOptions),
308 }
309}
310
311function collectCompletionTree(
312 command: CommanderCommand,

Callers 1

collectCompletionTreeFunction · 0.85

Calls 2

uniqSortedFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected