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

Function handler

src/commands/edge/channels/assign.ts:49–65  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

47
48
49const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
50 const command = await apiOrganizationCommand(argv)
51
52 const channelId = await chooseChannel(
53 command,
54 argv.channel,
55 { promptMessage: 'Select a channel for the driver.', useConfigDefault: true },
56 )
57 const driverId = await chooseDriver(command, argv.driverId, { promptMessage: 'Select a driver to assign.' })
58
59 // If the version wasn't specified, grab it from the driver.
60 const driverVersion = argv.driverVersion ?? (await command.client.drivers.get(driverId)).version
61
62 await command.client.channels.assignDriver(channelId, driverId, driverVersion)
63
64 console.log(`${driverId} (version ${driverVersion}) assigned to channel ${channelId}`)
65}
66
67const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
68export default cmd

Callers

nothing calls this directly

Calls 1

apiOrganizationCommandFunction · 0.85

Tested by

no test coverage detected