-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathpublish.ts
27 lines (19 loc) · 939 Bytes
/
publish.ts
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
27
import { DeviceProfileStatus } from '@smartthings/core-sdk'
import { APIOrganizationCommand, formatAndWriteItem } from '@smartthings/cli-lib'
import { buildTableOutput, chooseDeviceProfile } from '../../lib/commands/deviceprofiles-util'
export default class DeviceProfilePublishCommand extends APIOrganizationCommand<typeof DeviceProfilePublishCommand.flags> {
static description = 'publish a device profile (published profiles cannot be modified)'
static flags = {
...APIOrganizationCommand.flags,
...formatAndWriteItem.flags,
}
static args = [{
name: 'id',
description: 'device profile id',
}]
async run(): Promise<void> {
const id = await chooseDeviceProfile(this, this.args.id)
const deviceProfile = await this.client.deviceProfiles.updateStatus(id, DeviceProfileStatus.PUBLISHED)
await formatAndWriteItem(this, { buildTableOutput: data => buildTableOutput(this.tableGenerator, data) }, deviceProfile)
}
}