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

Function handler

src/commands/rules.ts:45–62  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

43 .epilog(buildEpilog({ command, apiDocs: ['listRules', 'getRule'] }))
44
45const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
46 const command = await apiCommand(argv)
47
48 const config: OutputItemOrListConfig<Rule & WithNamedLocation> = {
49 primaryKeyName: 'id',
50 sortKeyName: 'name',
51 listTableFieldDefinitions: ['name', 'id', 'locationId', 'location'],
52 tableFieldDefinitions,
53 }
54
55 await outputItemOrList(
56 command,
57 config,
58 argv.idOrIndex,
59 () => getRulesByLocation(command.client, argv.location),
60 id => getRuleWithLocation(command.client, id, argv.location),
61 )
62}
63
64const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
65export default cmd

Callers

nothing calls this directly

Calls 4

apiCommandFunction · 0.85
outputItemOrListFunction · 0.85
getRulesByLocationFunction · 0.85
getRuleWithLocationFunction · 0.85

Tested by

no test coverage detected