(yargs: Argv)
| 23 | const describe = 'execute a device command' |
| 24 | |
| 25 | const builder = (yargs: Argv): Argv<CommandArgs> => |
| 26 | inputItemBuilder(apiCommandBuilder(yargs)) |
| 27 | .positional('id', { describe: 'the device id', type: 'string' }) |
| 28 | .positional( |
| 29 | 'command', |
| 30 | { describe: 'the command [<component>]:<capability>:<command>([<arguments>])', type: 'string' }, |
| 31 | ) |
| 32 | .example([ |
| 33 | ['$0 devices:commands', 'prompt for a device and details of the command to send'], |
| 34 | [ |
| 35 | '$0 devices:commands 82532e8c-e35b-4fa8-b45f-58a083e5f3d2 switch:off', |
| 36 | 'send the "off" command for the "switch" capability to the specified device', |
| 37 | ], |
| 38 | [ |
| 39 | '$0 devices:commands 6d73e4d1-3278-44d4-915a-099a62f05330 \'switchLevel:setLevel(50)\'', |
| 40 | 'send the "setLevel" command, passing 50 as an argument, for the "switchLevel" capability to the' + |
| 41 | ' specified device (note: quotes prevent shell parsing errors)', |
| 42 | ], |
| 43 | ]) |
| 44 | .epilog(buildEpilog({ command, apiDocs: ['executeDeviceCommands'] })) |
| 45 | |
| 46 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 47 | const command = await apiCommand(argv) |
nothing calls this directly
no test coverage detected