(argv: ArgumentsCamelCase<CommandArgs>)
| 66 | .epilog(buildEpilog({ command })) |
| 67 | |
| 68 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 69 | const command = await apiOrganizationCommand(argv) |
| 70 | |
| 71 | const deviceProfileId = await chooseDeviceProfileFn({ verbose: argv.verbose })( |
| 72 | command, |
| 73 | argv.profileIdOrIndex, |
| 74 | { allowIndex: true }, |
| 75 | ) |
| 76 | |
| 77 | const config: OutputItemOrListConfig<DeviceProfileTranslations, LocaleReference> = { |
| 78 | primaryKeyName: 'tag', |
| 79 | sortKeyName: 'tag', |
| 80 | buildTableOutput: data => buildTableOutput(command.tableGenerator, data), |
| 81 | listTableFieldDefinitions: ['tag'], |
| 82 | } |
| 83 | await outputItemOrList<DeviceProfileTranslations, LocaleReference>( |
| 84 | command, |
| 85 | config, |
| 86 | argv.tag, |
| 87 | async () => await command.client.deviceProfiles.listLocales(deviceProfileId).catch(error => { |
| 88 | if (error.response?.status === 404) { |
| 89 | return [] |
| 90 | } |
| 91 | throw error |
| 92 | }), |
| 93 | async tag => await command.client.deviceProfiles.getTranslations(deviceProfileId, tag).catch(error => { |
| 94 | if (error.response?.status === 404) { |
| 95 | return fatalError(`No ${tag} translation exists for device profile ${deviceProfileId}.`) |
| 96 | } |
| 97 | throw error |
| 98 | }), |
| 99 | ) |
| 100 | } |
| 101 | |
| 102 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 103 | export default cmd |
nothing calls this directly
no test coverage detected