1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _cliEngineCommand = require('cli-engine-command');
|
8 |
|
9 | var _cliEngineCommand2 = _interopRequireDefault(_cliEngineCommand);
|
10 |
|
11 | var _util = require('../../util');
|
12 |
|
13 | var _plugins = require('../../plugins');
|
14 |
|
15 | var _plugins2 = _interopRequireDefault(_plugins);
|
16 |
|
17 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18 |
|
19 | let examplePlugins = {
|
20 | 'heroku-ci': { version: '1.8.0' },
|
21 | 'heroku-cli-status': { version: '3.0.10', type: 'link' },
|
22 | 'heroku-fork': { version: '4.1.22' }
|
23 | };
|
24 |
|
25 | let cli = 'heroku';
|
26 | if (global.config) {
|
27 | cli = global.config.bin;
|
28 | let pjson = global.config.pjson['cli-engine'];
|
29 | if (pjson['help'] && pjson['help']['plugins']) {
|
30 | examplePlugins = pjson['help']['plugins'];
|
31 | }
|
32 | }
|
33 | const examplePluginsHelp = Object.entries(examplePlugins).map(([name, p]) => ` ${name} ${p.version}`);
|
34 |
|
35 | class _class extends _cliEngineCommand2.default {
|
36 |
|
37 | async run() {
|
38 | let plugins = await new _plugins2.default(this.config).list();
|
39 | plugins = plugins.filter(p => p.type !== 'builtin');
|
40 | plugins.sort((0, _util.compare)('name'));
|
41 | if (!this.flags.core) plugins = plugins.filter(p => p.type !== 'core');
|
42 | if (!plugins.length) this.out.warn('no plugins installed');
|
43 | for (let plugin of plugins) {
|
44 | let output = `${plugin.name} ${this.out.color.dim(plugin.version)}`;
|
45 | if (plugin.type !== 'user') output += this.out.color.dim(` (${plugin.type})`);else if (plugin.tag !== 'latest') output += this.out.color.dim(` (${String(plugin.tag)})`);
|
46 | this.out.log(output);
|
47 | }
|
48 | }
|
49 | }
|
50 | exports.default = _class;
|
51 | _class.topic = 'plugins';
|
52 | _class.flags = { core: _cliEngineCommand.flags.boolean({ description: 'show core plugins' }) };
|
53 | _class.description = 'list installed plugins';
|
54 | _class.help = `Example:
|
55 | $ ${cli} plugins
|
56 | ${examplePluginsHelp.join('\n')}
|
57 | `; |
\ | No newline at end of file |