UNPKG

1.43 kBJavaScriptView Raw
1'use strict';
2
3var 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
13function pluginIsEnabled (x) {
14 return config.plugins[x] === undefined || config.plugins[x] === true;
15}
16
17var enabledPlugins = config.plugins && typeof config.plugins === 'object'
18 ? allPlugins.filter(pluginIsEnabled)
19 : allPlugins;
20
21var 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
25var 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
40module.exports = function (output) {
41 //msgs.forEach(function (msg) { log.print(msg); });
42 msgs.forEach(function (msg) { output.write(msg + '\n'); });
43};