(argv: ArgumentsCamelCase<CommandArgs>)
| 44 | .epilog(buildEpilog({ command })) |
| 45 | |
| 46 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 47 | const command = await apiCommand(argv) |
| 48 | |
| 49 | const limit = argv.limit |
| 50 | const perRequestLimit = calculateRequestLimit(limit) |
| 51 | |
| 52 | const id = await chooseLocation(command, argv.idOrIndex, { autoChoose: true, allowIndex: true }) |
| 53 | const params = { |
| 54 | locationId: id, |
| 55 | limit: perRequestLimit, |
| 56 | before: toEpochTime(argv.before), |
| 57 | after: toEpochTime(argv.after), |
| 58 | } |
| 59 | |
| 60 | if (calculateOutputFormat(argv) === 'common') { |
| 61 | if (limit > perRequestLimit) { |
| 62 | console.log(`History is limited to ${maxItemsPerRequest} items per request.`) |
| 63 | } |
| 64 | const history = await command.client.history.devices(params) |
| 65 | await writeDeviceEventsTable(command, history, { includeName: true, utcTimeFormat: argv.utc }) |
| 66 | } else { |
| 67 | const items = await getHistory(command.client, limit, perRequestLimit, params) |
| 68 | const outputFormatter = buildOutputFormatter<DeviceActivity[]>(argv, command.cliConfig) |
| 69 | await writeOutput(outputFormatter(items), argv.output) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 74 | export default cmd |
nothing calls this directly
no test coverage detected