1 | 'use strict'
|
2 |
|
3 | let cli = require('heroku-cli-util')
|
4 | let co = require('co')
|
5 |
|
6 | function * run (context, heroku) {
|
7 | let services = yield heroku.get('/addon-services')
|
8 |
|
9 | if (context.flags.json) {
|
10 | cli.styledJSON(services)
|
11 | } else {
|
12 | cli.table(services, {
|
13 | columns: [
|
14 | {key: 'name', label: 'slug'},
|
15 | {key: 'human_name', label: 'name'},
|
16 | {key: 'state', label: 'state'}
|
17 | ]
|
18 | })
|
19 | cli.log(`
|
20 | See plans with ${cli.color.blue('heroku addons:plans SERVICE')}`)
|
21 | }
|
22 | }
|
23 |
|
24 | module.exports = {
|
25 | topic: 'addons',
|
26 | command: 'services',
|
27 | description: 'list all available add-on services',
|
28 | flags: [
|
29 | {name: 'json', description: 'output in json format'}
|
30 | ],
|
31 | run: cli.command(co.wrap(run))
|
32 | }
|