(argv: ArgumentsCamelCase<CommandArgs>)
| 65 | .epilog(buildEpilog({ command, apiDocs: ['listInstallations', 'getInstallation'] })) |
| 66 | |
| 67 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 68 | const command = await apiCommand(argv) |
| 69 | |
| 70 | const config: OutputItemOrListConfig<InstalledApp & WithNamedLocation> = { |
| 71 | primaryKeyName: 'installedAppId', |
| 72 | sortKeyName: 'displayName', |
| 73 | listTableFieldDefinitions, |
| 74 | tableFieldDefinitions, |
| 75 | } |
| 76 | |
| 77 | if (argv.verbose) { |
| 78 | config.listTableFieldDefinitions.splice(3, 0, 'locationId', 'location') |
| 79 | config.tableFieldDefinitions.splice(7, 0, 'location') |
| 80 | } |
| 81 | const verboseInstalledApp: (app: Promise<InstalledApp>) => Promise<InstalledApp & WithNamedLocation> = |
| 82 | argv.verbose ? async app => withLocation(command.client, await app) : app => app |
| 83 | |
| 84 | const installedApps = async (): Promise<(InstalledApp & WithNamedLocation)[]> => { |
| 85 | const listOptions: InstalledAppListOptions = { |
| 86 | locationId: argv.location, |
| 87 | } |
| 88 | const apps = await command.client.installedApps.list(listOptions) |
| 89 | if (argv.verbose) { |
| 90 | return await withLocations(command.client, apps) |
| 91 | } |
| 92 | return apps |
| 93 | } |
| 94 | |
| 95 | await outputItemOrList( |
| 96 | command, |
| 97 | config, |
| 98 | argv.idOrIndex, |
| 99 | installedApps, |
| 100 | id => verboseInstalledApp(command.client.installedApps.get(id)), |
| 101 | ) |
| 102 | } |
| 103 | |
| 104 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 105 | export default cmd |
nothing calls this directly
no test coverage detected