(argv: ArgumentsCamelCase<CommandArgs>)
| 58 | })) |
| 59 | |
| 60 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 61 | const command = await apiCommand(argv) |
| 62 | |
| 63 | const deviceId = await chooseDeviceFn({ type: DeviceIntegrationType.VIRTUAL })(command, argv.deviceId) |
| 64 | |
| 65 | const createEvents = async (_: void, input: DeviceEvent[]): Promise<EventInputOutput[]> => { |
| 66 | const output = await command.client.virtualDevices.createEvents(deviceId, input) |
| 67 | return input.map((event, index) => ({ event, stateChange: output.stateChanges[index] })) |
| 68 | } |
| 69 | // TODO: This really should provide separate input processors for command line input and |
| 70 | // user input rather than doing it all in `getInputFromUser` |
| 71 | await inputAndOutputItem<DeviceEvent[], EventInputOutput[]>( |
| 72 | command, |
| 73 | { buildTableOutput: (data: EventInputOutput[]) => buildTableOutput(command.tableGenerator, data) }, |
| 74 | createEvents, |
| 75 | userInputProcessor(() => getInputFromUser(command, argv, deviceId)), |
| 76 | ) |
| 77 | } |
| 78 | |
| 79 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 80 | export default cmd |
nothing calls this directly
no test coverage detected