MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / handler

Function handler

src/commands/deviceprofiles/presentation.ts:61–77  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

59 }))
60
61const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
62 const command = await apiOrganizationCommand(argv)
63
64 const id = await chooseDeviceProfile(command, argv.idOrIndex, { allowIndex: true })
65
66 const profile = await command.client.deviceProfiles.get(id)
67 if (!profile.metadata) {
68 return fatalError('No presentation defined for device profile')
69 }
70
71 const presentation = await command.client.presentation.getPresentation(profile.metadata.vid, profile.metadata.mnmn)
72 await formatAndWriteItem(
73 command,
74 { buildTableOutput: data => buildTableOutput(command.tableGenerator, data) },
75 presentation,
76 )
77}
78
79const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
80export default cmd

Callers

nothing calls this directly

Calls 4

apiOrganizationCommandFunction · 0.85
fatalErrorFunction · 0.85
formatAndWriteItemFunction · 0.85
buildTableOutputFunction · 0.50

Tested by

no test coverage detected