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

Function handler

src/commands/capabilities/translations.ts:80–105  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

78export type CapabilitySummaryWithLocales = CapabilitySummaryWithNamespace & WithLocales
79
80const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
81 const command = await apiOrganizationCommand(argv)
82
83 const capabilityId = await chooseCapability(
84 command,
85 argv.idOrIndex,
86 argv.capabilityVersion,
87 { namespace: argv.namespace, allowIndex: true, verbose: argv.verbose },
88 )
89
90 const config: OutputItemOrListConfig<DeviceProfileTranslations, LocaleReference> = {
91 primaryKeyName: 'tag',
92 sortKeyName: 'tag',
93 listTableFieldDefinitions: ['tag'],
94 buildTableOutput: data => buildTableOutput(command.tableGenerator, data),
95 }
96
97 await outputItemOrList(
98 command,
99 config,
100 argv.tag,
101 () => command.client.capabilities.listLocales(capabilityId.id, capabilityId.version),
102 tag => command.client.capabilities.getTranslations(capabilityId.id, capabilityId.version, tag),
103 true,
104 )
105}
106
107const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
108export default cmd

Callers

nothing calls this directly

Calls 4

apiOrganizationCommandFunction · 0.85
outputItemOrListFunction · 0.85
chooseCapabilityFunction · 0.50
buildTableOutputFunction · 0.50

Tested by

no test coverage detected