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

Function builder

src/commands/virtualdevices.ts:32–75  ·  view source on GitHub ↗
(yargs: Argv)

Source from the content-addressed store, hash-verified

30const describe = 'list all virtual devices available in a user account or retrieve a single device'
31
32const builder = (yargs: Argv): Argv<CommandArgs> =>
33 outputItemOrListBuilder(apiCommandBuilder(yargs))
34 .positional(
35 'id-or-index',
36 { describe: 'the device id or number from list', type: 'string' },
37 )
38 .option(
39 'location',
40 { alias: 'l', describe: 'filter results by location', type: 'string', array: true },
41 )
42 .option(
43 'installed-app',
44 {
45 alias: 'a',
46 describe: 'filter results by installed app that created the device',
47 type: 'string',
48 },
49 )
50 .option(
51 'verbose',
52 {
53 alias: 'v',
54 describe: 'include location and room name in output',
55 type: 'boolean',
56 default: false,
57 },
58 )
59 .example([
60 ['$0 virtualdevices', 'list all virtualdevices'],
61 [
62 '$0 virtualdevices 1',
63 'display details for the first virtual device in the list retrieved by running ' +
64 '"smartthings virtualdevices"',
65 ],
66 [
67 '$0 virtualdevices 5dfd6626-ab1d-42da-bb76-90def3153998',
68 'display details for a virtual device by id',
69 ],
70 [
71 '$0 virtualdevices --location c822dcee-bb9f-41b8-915b-6406e5676845',
72 'list all virtual devices in the specified location',
73 ],
74 ])
75 .epilog(buildEpilog({ command }))
76
77const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
78 const command = await apiCommand(argv)

Callers

nothing calls this directly

Calls 2

apiCommandBuilderFunction · 0.85
buildEpilogFunction · 0.85

Tested by

no test coverage detected