-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathpresentation.ts
More file actions
26 lines (19 loc) · 854 Bytes
/
presentation.ts
File metadata and controls
26 lines (19 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { APICommand, chooseDevice, formatAndWriteItem } from '@smartthings/cli-lib'
import { buildTableOutput } from '../presentation'
export const tableFieldDefinitions = ['clientName', 'scope', 'redirectUris']
export default class DevicePresentationCommand extends APICommand<typeof DevicePresentationCommand.flags> {
static description = 'get a device presentation'
static flags = {
...APICommand.flags,
...formatAndWriteItem.flags,
}
static args = [{
name: 'id',
description: 'the device id or number in the list',
}]
async run(): Promise<void> {
const deviceId = await chooseDevice(this, this.args.id, { allowIndex: true })
const presentation = await this.client.devices.getPresentation(deviceId)
await formatAndWriteItem(this, { buildTableOutput: data => buildTableOutput(this.tableGenerator, data) }, presentation)
}
}