(argv: ArgumentsCamelCase<CommandArgs>)
| 52 | .epilog(buildEpilog({ command, apiDocs: ['listHubInstalledDrivers', 'getHubDeviceDriver'] })) |
| 53 | |
| 54 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 55 | const command = await apiCommand(argv) |
| 56 | |
| 57 | const config: OutputItemOrListConfig<InstalledDriver & WithNamedChannel> = { |
| 58 | primaryKeyName: 'driverId', |
| 59 | sortKeyName: 'name', |
| 60 | tableFieldDefinitions: ['name', 'driverId', 'description', 'version', 'channelId', |
| 61 | 'developer', 'vendorSupportInformation'], |
| 62 | listTableFieldDefinitions: ['name', 'driverId', 'version', 'channelId'], |
| 63 | } |
| 64 | if (argv.verbose) { |
| 65 | config.tableFieldDefinitions.splice(4, 0, 'channelName') |
| 66 | config.listTableFieldDefinitions.splice(3, 0, 'channelName') |
| 67 | } |
| 68 | const listInstalledWrapper: (drivers: Promise<InstalledDriver[]>) => Promise<(InstalledDriver & WithNamedChannel)[]> = |
| 69 | argv.verbose ? async drivers => withChannelNames(command.client, await drivers) : drivers => drivers |
| 70 | const getInstalledWrapper: (driver: Promise<InstalledDriver>) => Promise<InstalledDriver & WithNamedChannel> = |
| 71 | argv.verbose ? async driver => withChannelNames(command.client, await driver) : driver => driver |
| 72 | |
| 73 | const hubId = await chooseHub( |
| 74 | command, |
| 75 | argv.hub, |
| 76 | { promptMessage: 'Select a hub.', allowIndex: true, useConfigDefault: true }, |
| 77 | ) |
| 78 | |
| 79 | await outputItemOrList( |
| 80 | command, |
| 81 | config, |
| 82 | argv.idOrIndex, |
| 83 | () => listInstalledWrapper(command.client.hubdevices.listInstalled(hubId, argv.device)), |
| 84 | id => getInstalledWrapper(command.client.hubdevices.getInstalled(hubId, id)), |
| 85 | ) |
| 86 | } |
| 87 | |
| 88 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 89 | export default cmd |
nothing calls this directly
no test coverage detected