1 | 'use strict';
|
2 |
|
3 | var os = require('os')
|
4 | , format = require('util').format
|
5 | , colors = require('ansicolors')
|
6 | , styles = require('ansistyles')
|
7 | , log = require('./log')
|
8 | , pkg = require('../package')
|
9 | , config = require('../config/current')
|
10 | , allPlugins = [ 'vim', 'matchtoken' ]
|
11 | ;
|
12 |
|
13 | function pluginIsEnabled (x) {
|
14 | return config.plugins[x] === undefined || config.plugins[x] === true;
|
15 | }
|
16 |
|
17 | var enabledPlugins = config.plugins && typeof config.plugins === 'object'
|
18 | ? allPlugins.filter(pluginIsEnabled)
|
19 | : allPlugins;
|
20 |
|
21 | var specs = { cpus: Object.keys(os.cpus()).length, platform: os.platform(), host: os.hostname() }
|
22 | , v = process.versions
|
23 | , plugins = enabledPlugins.map(colors.yellow).join(' | ');
|
24 |
|
25 | var msgs = [
|
26 | ''
|
27 | , styles.underline(colors.brightRed('replpad')) + colors.yellow(' v' + pkg.version)
|
28 | , ''
|
29 | , format(colors.cyan('node') + ' %s', colors.yellow('v' + v.node))
|
30 | + format(' | %s | %s cpus | %s platform', colors.green(specs.host), colors.green(specs.cpus), colors.green(specs.platform))
|
31 | + format(colors.cyan(' | v8') + ' %s | ' + colors.cyan('uv') + ' %s', colors.yellow('v' + v.v8), colors.yellow('v' + v.uv))
|
32 | , ''
|
33 | , 'plugins: ' + plugins
|
34 | , ''
|
35 | , 'If in doubt, enter ' + colors.yellow('.help')
|
36 | , ''
|
37 | ];
|
38 |
|
39 |
|
40 | module.exports = function (output) {
|
41 |
|
42 | msgs.forEach(function (msg) { output.write(msg + '\n'); });
|
43 | };
|