mbo-test-cli
Version:
Logsene command-line interface
101 lines (80 loc) • 2.22 kB
JavaScript
#!/usr/bin/env node
var blessed = require('blessed'),
contrib = require('blessed-contrib'),
spinner = require('simple-spinner'),
request = require('request'),
argv = require('minimist')(process.argv.slice(2));
spinner.change_sequence([
"◓",
"◑",
"◒",
"◐"
]);
var screen = blessed.screen({
autoPadding: true,
smartCSR: true,
title: 'Logsene command-line interface'
});
var grid = new contrib.grid({rows: 12, cols: 12, screen: screen})
var log = grid.set(8, 6, 4, 2, contrib.log,
{fg: 'green',
selectedFg: 'green',
label: 'logsene log'});
//var res = request.get("http://")
spinner.start(50)
setTimeout(function() {
spinner.stop();
printArt();
}, 2000);
var art = [
" _ _",
" (c).-.(c) __",
" / ._. \\ / /| ____ ____ ____ ___ ____ ___ ",
" __\\( Y )/__ / / // __ \\/ __ `/ ___/ _ \\/ __ \\/ _ \\",
"(_.-/'-'\\-._)/ /_// /_/ / /_/ (__ ) __/ / / / __/\\",
" || S || /_____|____/\\__, /____/\\___/_/ /_/\\___/\\/",
" _.' `-' '._\\______\\___\\/____/\\___\\/\\__\\_\\/\\_\\/\\__\\/",
"(.-./`-'\\.-.) \\___\\/",
" `-' `-'"];
var printArt = function() {
for (var line in art) {
if (art.hasOwnProperty(line)) {
console.log(art[line]);
}
}
};
return;
/*
// Append our box to the screen.
screen.append(box);
// Add a PNG icon to the box (X11 only)
var icon = blessed.image({
parent: box,
top: 0,
left: 0,
width: 'shrink',
height: 'shrink',
file: __dirname + '/my-program-icon.png',
search: false
});
// If our box is clicked, change the content.
box.on('click', function(data) {
box.setContent('{center}Some different {red-fg}content{/red-fg}.{/center}');
screen.render();
});
// If box is focused, handle `enter`/`return` and give us some more content.
box.key('enter', function(ch, key) {
box.setContent('{right}Even different {black-fg}content{/black-fg}.{/right}\n');
box.setLine(1, 'bar');
box.insertLine(1, 'foo');
screen.render();
});
// Quit on Escape, q, or Control-C.
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});
// Focus our element.
box.focus();
*/
// Render the screen.
//screen.render();