我想集成的节点模块祝福和vorpal,谁能给我一些关于如何集成这两个模块的提示,非常感谢!
下面是我的草稿代码(仅供参考),我的目标是终端的左侧部分用于vorpal交互式CLI,右上角部分用于日志输出。
var blessed = require('blessed')
, screen;
var vorpal = require('vorpal')();
vorpal
.command('foo', 'bar')
.action(function(args, callback) {
this.log('bar');
callback();
});
vorpal
.delimiter('testapp$')
.show();
screen = blessed.screen({
dump: __dirname + '/logs/logger.log',
smartCSR: true,
autoPadding: false,
warnings: true
});
//This area I want the vorpal interactive CLI
var leftPart = blessed.box({
parent: screen,
left: 0,
top: 0,
width: '50%',
height: '100%',
border: {
type: 'line',
left: false,
top: false,
right: true,
bottom: false
},
// border: 'line',
content: 'I want here is the normal terminal input/output with vorpal style\n'+
'How can I do this?'
//content:vorpal
});
//This area with be the log output area
var logger = blessed.log({
parent: screen,
top: '0',
left: '50%-1',
width: '50%-1',
height: '50%-1',
border: 'line',
tags: true,
keys: true,
vi: true,
mouse: true,
scrollback: 100,
scrollbar: {
ch: ' ',
track: {
bg: 'yellow'
},
style: {
inverse: true
}
}
});
leftPart.focus();
setInterval(function() {
logger.log('Hello {#0fe1ab-fg}world{/}: {bold}%s{/bold}.', Date.now().toString(36));
//screen.render();
}, 1000).unref();
screen.key('q', function() {
return screen.destroy();
});
screen.render();发布于 2015-12-23 01:09:16
我不认为这是以前尝试过的,所以这是一种未知的领域!
我确实认为你将能够在Vorpal中使用受祝福的组件,但是我不确定你是否能够将Vorpal提示符填充到受祝福的方框包装中。Vorpal是基于Inquirer.js的,他的逻辑是根据提示符的位置而设计的。
也许您将日志框放在屏幕顶部,并保持Vorpal提示符的位置。
尝试一下,看看它是否有效--并在进行的过程中随时询问更多的问题!
https://stackoverflow.com/questions/34414603
复制相似问题