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

Function handler

src/commands/devices/component-status.ts:48–66  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

46 .epilog(buildEpilog({ command, apiDocs: ['getDeviceComponentStatus'] }))
47
48const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
49 const command = await apiCommand(argv)
50
51 const deviceId = await chooseDevice(command, argv.deviceIdOrIndex, { allowIndex: true })
52
53 const device = await command.client.devices.get(deviceId)
54 const componentName = await chooseComponentFn(device)(
55 command,
56 argv.componentId,
57 { autoChoose: true, allowIndex: true },
58 )
59
60 const componentStatus = await command.client.devices.getComponentStatus(deviceId, componentName)
61 await formatAndWriteItem(
62 command,
63 { buildTableOutput: data => buildComponentStatusTableOutput(command.tableGenerator, data) },
64 componentStatus,
65 )
66}
67
68const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
69export default cmd

Callers

nothing calls this directly

Calls 4

apiCommandFunction · 0.85
chooseComponentFnFunction · 0.85
formatAndWriteItemFunction · 0.85

Tested by

no test coverage detected