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

Function handler

src/commands/devices/commands.ts:46–63  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

44 .epilog(buildEpilog({ command, apiDocs: ['executeDeviceCommands'] }))
45
46const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
47 const command = await apiCommand(argv)
48
49 const deviceId = await chooseDevice(command, argv.id)
50
51 const [commands] = await inputItem<Command>(
52 argv,
53 commandLineInputProcessor({
54 hasCommandLineInput: () => !!argv.command,
55 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
56 getInputFromCommandLine: async () => parseDeviceCommand(argv.command!),
57 }),
58 userInputProcessor(() => getInputFromUser(command, deviceId)),
59 )
60
61 await command.client.devices.executeCommands(deviceId, [commands])
62 console.log('Command executed successfully')
63}
64
65const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
66export default cmd

Callers

nothing calls this directly

Calls 5

apiCommandFunction · 0.85
parseDeviceCommandFunction · 0.85
userInputProcessorFunction · 0.85
getInputFromUserFunction · 0.50

Tested by

no test coverage detected