Socket
Socket
Sign inDemoInstall

vtop

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vtop - npm Package Compare versions

Comparing version 0.1.8 to 0.2.0

CHANGELOG.md

79

app.js

@@ -20,3 +20,4 @@ /**

os = require('os'),
cli = require('commander');
cli = require('commander'),
upgrade = require('./upgrade.js');

@@ -29,4 +30,9 @@ // Set up the commander instance and add the required options

*/
var screen, charts = [], loadedTheme;
var screen,
charts = [],
loadedTheme,
intervals = [];
var upgradeNotice = false;
// Private variables

@@ -65,9 +71,19 @@

var drawHeader = function() {
var headerText, headerTextNoTags;
if (upgradeNotice) {
upgradeNotice = upgradeNotice + '';
headerText = ' {bold}vtop{/bold}{white-fg} for ' + os.hostname() + ' {red-bg} Press \'u\' to upgrade to v' + upgradeNotice + ' {/red-bg}{/white-fg}';
headerTextNoTags = ' vtop for ' + os.hostname() + ' Press \'u\' to upgrade to v' + upgradeNotice + ' ';
} else {
headerText = ' {bold}vtop{/bold}{white-fg} for ' + os.hostname() + ' ';
headerTextNoTags = ' vtop for ' + os.hostname() + ' ';
}
var header = blessed.text({
top: 'top',
left: 'left',
width: '50%',
width: headerTextNoTags.length,
height: '1',
fg: loadedTheme.title.fg,
content: ' {bold}vtop{/bold}{white-fg} for ' + os.hostname() + '{/white-fg}',
content: headerText,
tags: true

@@ -77,4 +93,4 @@ });

top: 'top',
left: '50%',
width: '50%',
right: 0,
width: 9,
height: '1',

@@ -252,4 +268,2 @@ align: 'right',

graph2.setContent(drawChart(chartKey + 1));
//console.log(processList.width);
//console.log(charts[2].plugin.currentValue);
processList.setContent(drawTable(chartKey + 2));

@@ -266,4 +280,9 @@

var theme = cli.theme;
loadedTheme = require('./themes/' + theme + '.json');
try {
loadedTheme = require('./themes/' + theme + '.json');
} catch(e) {
console.log('The theme \'' + theme + '\' does not exist.');
process.exit(1);
}
// Create a screen object.

@@ -273,9 +292,40 @@ screen = blessed.screen();

// Configure 'q', esc, Ctrl+C for quit
var upgrading = false;
upgrade.check(function(v) {
upgradeNotice = v;
});
screen.on('keypress', function(ch, key) {
if (key.name === 'q' || key.name === 'escape' || (key.name == 'c' && key.ctrl === true)) {
if (
upgrading == false &&
(
key.name === 'q' ||
key.name === 'escape' ||
(key.name == 'c' && key.ctrl === true)
)
) {
return process.exit(0);
}
if (key.name === 'u' && upgrading == false) {
upgrading = true;
// Clear all intervals
for (var interval in intervals) {
clearInterval(intervals[interval]);
}
program = blessed.program();
program.clear();
program.disableMouse();
program.showCursor();
program.normalBuffer();
// @todo: show changelog AND smush existing data into it :D
upgrade.install('vtop');
}
});
drawHeader();
setInterval(drawHeader, 1000);
drawFooter();

@@ -342,3 +392,2 @@

var setupCharts = function() {
// @todo: Fix these drunken magic numbers
size.pixel.width = (graph.width - 2) * 2;

@@ -394,8 +443,8 @@ size.pixel.height = (graph.height - 2) * 4;

screen.on('resize', setupCharts);
setInterval(draw, 100);
intervals.push(setInterval(draw, 100));
// @todo Make this more sexy
setInterval(charts[0].plugin.poll, charts[0].plugin.interval);
setInterval(charts[1].plugin.poll, charts[1].plugin.interval);
setInterval(charts[2].plugin.poll, charts[2].plugin.interval);
intervals.push(setInterval(charts[0].plugin.poll, charts[0].plugin.interval));
intervals.push(setInterval(charts[1].plugin.poll, charts[1].plugin.interval));
intervals.push(setInterval(charts[2].plugin.poll, charts[2].plugin.interval));

@@ -402,0 +451,0 @@ }

5

package.json
{
"name": "vtop",
"version": "0.1.8",
"version": "0.2.0",
"description": "Wow such top. So stats",

@@ -29,4 +29,5 @@ "homepage": "http://parall.ax/vtop",

"blessed": "0.0.33",
"commander": "2.2.0"
"commander": "2.2.0",
"sudo": "1.0.3"
}
}

@@ -14,3 +14,3 @@ vtop

```
npm install -g vtop
sudo npm install -g vtop
```

@@ -17,0 +17,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc