1 | 'use strict';
|
2 |
|
3 | let co = require('co');
|
4 | let cli = require('heroku-cli-util');
|
5 |
|
6 | function* run (context, heroku) {
|
7 | let client = yield heroku.get(`/oauth/clients/${context.args.id}`);
|
8 | if (context.flags.json) {
|
9 | cli.log(JSON.stringify(client, null, 2));
|
10 | } else if (context.flags.shell) {
|
11 | cli.log(`HEROKU_OAUTH_ID=${client.id}`);
|
12 | cli.log(`HEROKU_OAUTH_SECRET=${client.secret}`);
|
13 | } else {
|
14 | cli.styledHeader(client.name);
|
15 | cli.styledObject(client);
|
16 | }
|
17 | }
|
18 |
|
19 | module.exports = {
|
20 | topic: 'clients',
|
21 | command: 'info',
|
22 | description: 'show details of an oauth client',
|
23 | needsAuth: true,
|
24 | args: [{name: 'id'}],
|
25 | flags: [
|
26 | {name: 'json', description: 'output in json format'},
|
27 | {name: 'shell', char: 's', description: 'output in shell format'},
|
28 | ],
|
29 | run: cli.command(co.wrap(run))
|
30 | };
|