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

Function handler

src/commands/edge/drivers.ts:67–89  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

65 }))
66
67const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
68 const command = await apiOrganizationCommand(argv)
69
70 const config: OutputItemOrListConfig<EdgeDriver & WithOrganization> = {
71 primaryKeyName: 'driverId',
72 sortKeyName: 'name',
73 buildTableOutput: (driver: EdgeDriver) => buildTableOutput(command.tableGenerator, driver),
74 listTableFieldDefinitions,
75 }
76
77 if (argv.allOrganizations) {
78 config.listTableFieldDefinitions.push('organization')
79 }
80
81 const getDriver = (id: string): Promise<EdgeDriver> =>
82 argv.driverVersion
83 ? command.client.drivers.getRevision(id, argv.driverVersion)
84 : command.client.drivers.get(id)
85
86 await outputItemOrList<EdgeDriver & WithOrganization>(command, config, argv.idOrIndex,
87 () => listDrivers(command.client, argv.allOrganizations),
88 getDriver)
89}
90
91const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
92export default cmd

Callers

nothing calls this directly

Calls 3

apiOrganizationCommandFunction · 0.85
listDriversFunction · 0.85
buildTableOutputFunction · 0.50

Tested by

no test coverage detected