(argv: ArgumentsCamelCase<CommandArgs>)
| 83 | .epilog(buildEpilog({ command, apiDocs: ['listNamespacedCapabilities', 'listCapabilities', 'getCapability'] })) |
| 84 | |
| 85 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 86 | const command = await apiOrganizationCommand(argv) |
| 87 | |
| 88 | const idOrIndex = argv.idOrIndex |
| 89 | ? (argv.capabilityVersion |
| 90 | ? { id: argv.idOrIndex, version: argv.capabilityVersion } |
| 91 | : argv.idOrIndex) |
| 92 | : undefined |
| 93 | const sortKeyName = 'id' |
| 94 | const config: OutputItemOrListConfig<Capability, CapabilitySummaryWithNamespace & WithOrganization> = { |
| 95 | primaryKeyName: 'id', |
| 96 | sortKeyName, |
| 97 | itemName: 'capability', |
| 98 | pluralItemName: 'capabilities', |
| 99 | listTableFieldDefinitions: ['id', 'version', 'status'], |
| 100 | buildTableOutput: (data: Capability) => buildTableOutput(command.tableGenerator, data), |
| 101 | } |
| 102 | const listItems = (): Promise<(CapabilitySummaryWithNamespace & WithOrganization)[]> => { |
| 103 | if (argv.standard) { |
| 104 | return getStandard(command.client) |
| 105 | } else if (argv.allOrganizations) { |
| 106 | config.listTableFieldDefinitions.push('organization') |
| 107 | return forAllOrganizations(command.client, orgClient => |
| 108 | getCustomByNamespace(orgClient, argv.namespace)) |
| 109 | } |
| 110 | return getCustomByNamespace(command.client, argv.namespace) |
| 111 | } |
| 112 | await outputItemOrListGeneric(command, config, idOrIndex, |
| 113 | listItems, |
| 114 | (id: CapabilityId) => command.client.capabilities.get(id.id, id.version), |
| 115 | (idOrIndex, listFunction) => translateToId(sortKeyName, idOrIndex, listFunction)) |
| 116 | } |
| 117 | |
| 118 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 119 | export default cmd |
nothing calls this directly
no test coverage detected