-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathinfo.ts
47 lines (40 loc) · 1.29 KB
/
info.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import {Args, ux} from '@oclif/core'
import {listPipelineApps} from '../../lib/api'
import disambiguate from '../../lib/pipelines/disambiguate'
import renderPipeline from '../../lib/pipelines/render-pipeline'
export default class PipelinesInfo extends Command {
static description = 'show list of apps in a pipeline'
static examples = [
'$ heroku pipelines:info my-pipeline',
]
static flags = {
json: flags.boolean({
description: 'output in json format',
}),
'with-owners': flags.boolean({
description: 'shows owner of every app',
hidden: true,
}),
}
static args = {
pipeline: Args.string({
description: 'pipeline to show list of apps for',
required: true,
}),
}
async run() {
const {args, flags} = await this.parse(PipelinesInfo)
const pipeline: Heroku.Pipeline = await disambiguate(this.heroku, args.pipeline)
const pipelineApps = await listPipelineApps(this.heroku, pipeline.id!)
if (flags.json) {
ux.styledJSON({pipeline, apps: pipelineApps})
} else {
await renderPipeline(this.heroku, pipeline, pipelineApps, {
withOwners: flags['with-owners'],
showOwnerWarning: true,
})
}
}
}