-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathupdate.ts
28 lines (22 loc) · 870 Bytes
/
update.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
28
import { AppSettings } from '@smartthings/core-sdk'
import { APICommand, inputAndOutputItem } from '@smartthings/cli-lib'
import { buildTableOutput, chooseApp } from '../../../lib/commands/apps/apps-util'
export default class AppSettingsUpdateCommand extends APICommand {
static description = 'update the settings of the app'
static flags = {
...APICommand.flags,
...inputAndOutputItem.flags,
}
static args = [{
name: 'id',
description: 'the app id',
}]
async run(): Promise<void> {
const { args, argv, flags } = await this.parse(AppSettingsUpdateCommand)
await super.setup(args, argv, flags)
const appId = await chooseApp(this, args.id)
await inputAndOutputItem(this,
{ buildTableOutput: (data: AppSettings) => buildTableOutput(this.tableGenerator, data) },
(_, data: AppSettings) => this.client.apps.updateSettings(appId, data))
}
}