UNPKG

794 BJavaScriptView Raw
1'use strict'
2
3let cli = require('heroku-cli-util')
4let co = require('co')
5
6function * run (context, heroku) {
7 let lib = require('../../lib/log-drains')(heroku)
8 let drain = yield lib.getLogDrain(context.flags.space)
9 if (context.flags.json) {
10 cli.log(JSON.stringify(drain, null, 2))
11 } else {
12 let output = `${cli.color.cyan(drain.url)} (${cli.color.green(drain.token)})`
13 cli.log(output)
14 }
15}
16
17module.exports = {
18 topic: 'drains',
19 command: 'get',
20 hidden: true,
21 description: 'display the log drain for a space',
22 needsApp: false,
23 needsAuth: true,
24 flags: [
25 {name: 'space', char: 's', hasValue: true, description: 'space for which to get log drain', required: true},
26 {name: 'json', description: 'output in json format'}
27 ],
28 run: cli.command(co.wrap(run))
29}