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

Function handler

src/commands/locations/modes/getcurrent.ts:53–66  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

51 .epilog(buildEpilog({ command, apiDocs: 'getCurrentMode' }))
52
53const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
54 const command = await apiCommand(argv)
55
56 const config: FormatAndWriteItemConfig<Mode & WithNamedLocation> = {
57 tableFieldDefinitions,
58 }
59 if (argv.verbose) {
60 config.tableFieldDefinitions = tableFieldDefinitionsWithLocationName
61 }
62 const locationId = await chooseLocation(command, argv.location, { autoChoose: true })
63 const currentMode = await command.client.modes.getCurrent(locationId)
64 const mode = argv.verbose ? await withLocation(command.client, { ...currentMode, locationId }) : currentMode
65 await formatAndWriteItem<Mode & WithNamedLocation>(command, config, mode)
66}
67
68const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
69export default cmd

Callers

nothing calls this directly

Calls 2

apiCommandFunction · 0.85
withLocationFunction · 0.85

Tested by

no test coverage detected