(argv: ArgumentsCamelCase<CommandArgs>)
| 48 | .epilog(buildEpilog({ command, apiDocs: ['getDeviceProfile', 'getDeviceConfiguration'] })) |
| 49 | |
| 50 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 51 | const command = await apiOrganizationCommand(argv) |
| 52 | |
| 53 | const getDeviceProfileAndConfig = async (id: string): Promise<DeviceDefinition> => { |
| 54 | const profile = await command.client.deviceProfiles.get(id) |
| 55 | if (profile.metadata) { |
| 56 | try { |
| 57 | const view = await command.client.presentation.get(profile.metadata.vid, profile.metadata.mnmn) |
| 58 | return { ...profile, view: prunePresentation(view) } |
| 59 | } catch (error) { |
| 60 | command.logger.warn(error) |
| 61 | return profile |
| 62 | } |
| 63 | } |
| 64 | return profile |
| 65 | } |
| 66 | |
| 67 | const profileId = await chooseDeviceProfile(command, argv.idOrIndex, { allowIndex: true }) |
| 68 | const profileAndConfig = await getDeviceProfileAndConfig(profileId) |
| 69 | await formatAndWriteItem( |
| 70 | command, |
| 71 | { buildTableOutput: data => buildTableOutput(command.tableGenerator, data) }, |
| 72 | profileAndConfig, |
| 73 | ) |
| 74 | } |
| 75 | |
| 76 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 77 | export default cmd |
nothing calls this directly
no test coverage detected