(argv: ArgumentsCamelCase<CommandArgs>)
| 338 | } |
| 339 | |
| 340 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 341 | const command = await apiOrganizationCommand(argv) |
| 342 | |
| 343 | const params: HttpClientParams = {} |
| 344 | if (argv.namespace) { |
| 345 | params.namespace = argv.namespace |
| 346 | } |
| 347 | |
| 348 | const createCapability = async (_: void, capability: CapabilityCreate): Promise<Capability> => { |
| 349 | return command.client.capabilities.create(capability, params) |
| 350 | .catch(error => { |
| 351 | if (error.response?.status == 403 && argv.namespace) { |
| 352 | return fatalError('Unable to create capability under specified namespace. ' + |
| 353 | 'Either the namespace does not exist or you do not have permission.') |
| 354 | } |
| 355 | |
| 356 | throw error |
| 357 | }) |
| 358 | } |
| 359 | |
| 360 | await inputAndOutputItem(command, |
| 361 | { buildTableOutput: data => buildTableOutput(command.tableGenerator, data) }, |
| 362 | createCapability, userInputProcessor(() => getInputFromUser({ dryRun: !!argv.dryRun }))) |
| 363 | } |
| 364 | |
| 365 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 366 | export default cmd |
nothing calls this directly
no test coverage detected