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

Function builder

src/commands/virtualdevices/events.ts:30–58  ·  view source on GitHub ↗
(yargs: Argv)

Source from the content-addressed store, hash-verified

28const describe = 'create events for a virtual device'
29
30const builder = (yargs: Argv): Argv<CommandArgs> =>
31 inputAndOutputItemBuilder(apiCommandBuilder(yargs))
32 .positional('id', { describe: 'the device id', type: 'string' })
33 .positional(
34 'name',
35 { describe: 'the fully qualified attribute name [<component>]:<capability>:<attribute>', type: 'string' },
36 )
37 .positional('value', { describe: 'the attribute value', type: 'string' })
38 .positional('unit', { describe: 'optional unit of measure', type: 'string' })
39 .example([
40 ['$0 virtualdevices:events', 'create an event in interactive mode'],
41 [
42 '$0 virtualdevices:events -i data.yaml',
43 'create events from the definition in "data.yaml"',
44 ],
45 [
46 '$0 virtualdevices:events d26c8802-179d-443b-b3e6-2d35d76c1560 switch:switch on',
47 'create an event, specifying all details on the command line',
48 ],
49 [
50 '$0 virtualdevices:events d26c8802-179d-443b-b3e6-2d35d76c1560 temperatureMeasurement:temperature 22.5 C',
51 'create an event, specifying all details on the command line',
52 ],
53 ])
54 .epilog(buildEpilog({
55 command,
56 notes: 'The command can be run interactively in question & answer mode, with command line parameters,' +
57 ' or with input from a file or standard in.',
58 }))
59
60const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
61 const command = await apiCommand(argv)

Callers

nothing calls this directly

Calls 3

apiCommandBuilderFunction · 0.85
buildEpilogFunction · 0.85

Tested by

no test coverage detected