(argv: ArgumentsCamelCase<CommandArgs>)
| 50 | .epilog(buildEpilog({ command, apiDocs: ['listRooms', 'getRoom'] })) |
| 51 | |
| 52 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 53 | const command = await apiCommand(argv) |
| 54 | |
| 55 | const config: OutputItemOrListConfig<Room & WithNamedLocation> = { |
| 56 | primaryKeyName: 'roomId', |
| 57 | sortKeyName: 'name', |
| 58 | listTableFieldDefinitions: tableFieldDefinitions, |
| 59 | tableFieldDefinitions: tableFieldDefinitions, |
| 60 | } |
| 61 | if (argv.verbose) { |
| 62 | config.listTableFieldDefinitions = tableFieldDefinitionsWithLocationName |
| 63 | config.tableFieldDefinitions = tableFieldDefinitionsWithLocationName |
| 64 | } |
| 65 | const rooms = await getRoomsWithLocation(command.client, argv.location) |
| 66 | await outputItemOrList<Room & WithNamedLocation>( |
| 67 | command, |
| 68 | config, |
| 69 | argv.idOrIndex, |
| 70 | async () => rooms, |
| 71 | async id => { |
| 72 | const room = rooms.find(room => room.roomId === id) |
| 73 | if (!room) { |
| 74 | return fatalError(`Could not find room with id ${id}.`) |
| 75 | } |
| 76 | return room |
| 77 | }) |
| 78 | } |
| 79 | |
| 80 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 81 | export default cmd |
nothing calls this directly
no test coverage detected