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

Function handler

src/commands/edge/channels/metainfo.ts:58–87  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

56 .epilog(buildEpilog({ command }))
57
58const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
59 const command = await apiOrganizationCommand(argv)
60
61 const channelId = await chooseChannel(
62 command,
63 argv.channel,
64 { useConfigDefault: true, promptMessage: 'Choose a channel to get meta info for.' },
65 )
66
67 const config: OutputItemOrListConfig<EdgeDriver> = {
68 primaryKeyName: 'driverId',
69 sortKeyName: 'name',
70 buildTableOutput: (driver: EdgeDriver) => buildTableOutput(command.tableGenerator, driver),
71 listTableFieldDefinitions,
72 }
73
74 const listDriversMetaInfo = async (): Promise<EdgeDriver[]> => {
75 const drivers = await command.client.channels.listAssignedDrivers(channelId)
76 return Promise.all(drivers.map(async driver =>
77 await command.client.channels.getDriverChannelMetaInfo(channelId, driver.driverId)))
78 }
79
80 await outputItemOrList(
81 command,
82 config,
83 argv.driverIdOrIndex,
84 listDriversMetaInfo,
85 driverId => command.client.channels.getDriverChannelMetaInfo(channelId, driverId),
86 )
87}
88
89const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
90export default cmd

Callers

nothing calls this directly

Calls 3

apiOrganizationCommandFunction · 0.85
outputItemOrListFunction · 0.85
buildTableOutputFunction · 0.50

Tested by

no test coverage detected