(argv: ArgumentsCamelCase<CommandArgs>)
| 54 | .epilog(buildEpilog({ command, apiDocs: ['listDeviceProfiles', 'getDeviceProfile'] })) |
| 55 | |
| 56 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 57 | const command = await apiOrganizationCommand(argv) |
| 58 | |
| 59 | const config: OutputItemOrListConfig<DeviceProfile & WithOrganization> = { |
| 60 | primaryKeyName: 'id', |
| 61 | sortKeyName: 'name', |
| 62 | listTableFieldDefinitions: ['name', 'status', 'id'], |
| 63 | buildTableOutput: (data: DeviceProfile) => buildTableOutput(command.tableGenerator, data), |
| 64 | } |
| 65 | |
| 66 | if (argv.allOrganizations) { |
| 67 | config.listTableFieldDefinitions = ['name', 'status', 'id', 'organization'] |
| 68 | } |
| 69 | |
| 70 | if (argv.verbose) { |
| 71 | config.listTableFieldDefinitions.push({ |
| 72 | label: 'Profile Id', |
| 73 | value: item => item.metadata?.vid ?? '', |
| 74 | }) |
| 75 | config.listTableFieldDefinitions.push({ |
| 76 | label: 'Manufacturer Name', |
| 77 | value: item => item.metadata?.mnmn ?? '', |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | await outputItemOrList<DeviceProfile & WithOrganization>( |
| 82 | command, |
| 83 | config, |
| 84 | argv.idOrIndex, |
| 85 | () => argv.allOrganizations |
| 86 | ? forAllOrganizations(command.client, (orgClient) => orgClient.deviceProfiles.list()) |
| 87 | : command.client.deviceProfiles.list(), |
| 88 | id => command.client.deviceProfiles.get(id), |
| 89 | ) |
| 90 | } |
| 91 | |
| 92 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 93 | export default cmd |
nothing calls this directly
no test coverage detected