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

Function builder

src/commands/devices.ts:44–116  ·  view source on GitHub ↗
(yargs: Argv)

Source from the content-addressed store, hash-verified

42const describe = 'get a list of devices or details of a specific device'
43
44const builder = (yargs: Argv): Argv<CommandArgs> =>
45 outputItemOrListBuilder(apiCommandBuilder(yargs))
46 .positional('id-or-index', { describe: 'the device id or number from list', type: 'string' })
47 .option('location', {
48 alias: 'l',
49 describe: 'filter results by location',
50 type: 'string',
51 array: true,
52 })
53 .option('capability', {
54 alias: 'c',
55 describe: 'filter results by capability',
56 type: 'string',
57 array: true,
58 })
59 .option('capabilities-mode', {
60 alias: 'C',
61 choices: ['and', 'or'],
62 describe: 'logical operator for multiple capability filter options',
63 default: 'and',
64 })
65 .option('device', {
66 alias: 'd',
67 describe: 'filter results by device',
68 type: 'string',
69 array: true,
70 })
71 .option('installed-app', {
72 alias: 'a',
73 describe: 'filter results by installed app that created the device',
74 type: 'string',
75 })
76 .option('status', {
77 alias: 's',
78 describe: 'include attribute values in the response',
79 type: 'boolean',
80 default: false,
81 })
82 .option('health', {
83 alias: 'H',
84 describe: 'include device health in the response',
85 type: 'boolean',
86 default: false,
87 })
88 .option('type', {
89 describe: 'filter results by device integration type',
90 type: 'string',
91 array: true,
92 choices: Object.values(DeviceIntegrationType),
93 coerce: arg => arg?.map((str: string) => str.toUpperCase() as DeviceIntegrationType),
94 })
95 .option('verbose',
96 { alias: 'v', describe: 'include location and room name in output', type: 'boolean', default: false })
97 .example([
98 ['$0 devices', 'list all devices'],
99 [
100 '$0 devices 1',
101 'display details for the first device in the list retrieved by running "smartthings devices"',

Callers

nothing calls this directly

Calls 2

apiCommandBuilderFunction · 0.85
buildEpilogFunction · 0.85

Tested by

no test coverage detected