1 | 'use strict';
|
2 |
|
3 | let co = require('co');
|
4 | let cli = require('heroku-cli-util');
|
5 |
|
6 | function* run (context, heroku) {
|
7 | let clients = yield heroku.get('/oauth/clients');
|
8 | if (context.flags.json) {
|
9 | cli.log(JSON.stringify(clients, null, 2));
|
10 | } else if (clients.length === 0) {
|
11 | cli.log('No oauth clients.');
|
12 | } else {
|
13 | cli.table(clients, {
|
14 | printHeader: null,
|
15 | columns: [
|
16 | {key: 'name'},
|
17 | {key: 'id'},
|
18 | {key: 'redirect_uri'},
|
19 | ]
|
20 | });
|
21 | }
|
22 | }
|
23 |
|
24 | module.exports = {
|
25 | topic: 'clients',
|
26 | description: 'list your OAuth clients',
|
27 | needsAuth: true,
|
28 | flags: [
|
29 | {name: 'json', description: 'output in json format'}
|
30 | ],
|
31 | run: cli.command(co.wrap(run))
|
32 | };
|