MCPcopy Index your code
hub / github.com/SmartThingsCommunity/smartthings-cli / handler

Function handler

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

Source from the content-addressed store, hash-verified

61 .epilog(buildEpilog({ command, apiDocs: ['getIsaByLocationId', 'getDevicesByIsaId'] }))
62
63const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
64 const command = await apiCommand(argv)
65
66 const config: OutputItemOrListConfig<InstalledSchemaApp & WithNamedLocation> = {
67 primaryKeyName: 'isaId',
68 sortKeyName: 'appName',
69 listTableFieldDefinitions,
70 tableFieldDefinitions,
71 }
72
73 if (argv.verbose) {
74 config.listTableFieldDefinitions = listTableFieldDefinitions.toSpliced(3, 0, 'locationId', 'location')
75 config.tableFieldDefinitions = tableFieldDefinitions.toSpliced(5, 0, 'location')
76 }
77 const verboseInstalledApp: (app: Promise<InstalledSchemaApp>) => Promise<InstalledSchemaApp & WithNamedLocation> =
78 async app => argv.verbose ? withLocation(command.client, await app) : app
79
80 await outputItemOrList(
81 command,
82 config,
83 argv.idOrIndex,
84 () => installedSchemaInstances(command.client, argv.location, { verbose: argv.verbose }),
85 id => verboseInstalledApp(command.client.schema.getInstalledApp(id)),
86 )
87}
88
89const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
90export default cmd

Callers

nothing calls this directly

Calls 4

apiCommandFunction · 0.85
outputItemOrListFunction · 0.85
installedSchemaInstancesFunction · 0.85
verboseInstalledAppFunction · 0.85

Tested by

no test coverage detected