summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCan Güney Aksakalli <cgaksakalli@gmail.com>2020-02-18 13:06:52 +0100
committerCan Güney Aksakalli <cgaksakalli@gmail.com>2020-02-18 13:06:52 +0100
commit6e08a3fcce04565e491b3ea450c10864186354d1 (patch)
tree3f5a9f796e294fefa41bc13ecd881224b1aeb987
parent475c5bc6d683c230de85a9543a879699489e5637 (diff)
fix: lint cmd target
-rw-r--r--lib/gtop.js38
-rw-r--r--lib/utils.js14
-rw-r--r--package.json2
3 files changed, 26 insertions, 28 deletions
diff --git a/lib/gtop.js b/lib/gtop.js
index 57fb76f..2e62772 100644
--- a/lib/gtop.js
+++ b/lib/gtop.js
@@ -2,20 +2,19 @@ var blessed = require('blessed'),
contrib = require('blessed-contrib'),
monitor = require('./monitor');
-
-var screen = blessed.screen()
+var screen = blessed.screen();
var grid = new contrib.grid({
rows: 12,
cols: 12,
- screen: screen
-})
+ screen: screen,
+});
var cpuLine = grid.set(0, 0, 4, 12, contrib.line, {
showNthLabel: 5,
maxY: 100,
label: 'CPU History',
showLegend: true,
-})
+});
var memLine = grid.set(4, 0, 4, 8, contrib.line, {
showNthLabel: 5,
@@ -23,9 +22,9 @@ var memLine = grid.set(4, 0, 4, 8, contrib.line, {
label: 'Memory and Swap History',
showLegend: true,
legend: {
- width: 10
- }
-})
+ width: 10,
+ },
+});
var memDonut = grid.set(4, 8, 2, 4, contrib.donut, {
radius: 8,
@@ -47,9 +46,9 @@ var netSpark = grid.set(8, 0, 2, 6, contrib.sparkline, {
label: 'Network History',
tags: true,
style: {
- fg: 'blue'
- }
-})
+ fg: 'blue',
+ },
+});
var diskDonut = grid.set(10, 0, 2, 6, contrib.donut, {
radius: 8,
@@ -57,19 +56,19 @@ var diskDonut = grid.set(10, 0, 2, 6, contrib.donut, {
yPadding: 2,
remainColor: 'black',
label: 'Disk usage',
-})
+});
var procTable = grid.set(8, 6, 4, 6, contrib.table, {
keys: true,
label: 'Processes',
columnSpacing: 1,
- columnWidth: [7, 24, 7, 7]
-})
+ columnWidth: [7, 24, 7, 7],
+});
-procTable.focus()
+procTable.focus();
screen.render();
-screen.on('resize', function (a) {
+screen.on('resize', function(a) {
cpuLine.emit('attach');
memLine.emit('attach');
memDonut.emit('attach');
@@ -79,7 +78,7 @@ screen.on('resize', function (a) {
procTable.emit('attach');
});
-screen.key(['escape', 'q', 'C-c'], function (ch, key) {
+screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});
@@ -91,12 +90,11 @@ function init() {
new monitor.Proc(procTable); // no Windows support
}
-
-process.on('uncaughtException', function (err) {
+process.on('uncaughtException', function(err) {
// avoid exiting due to unsupported system resources in Windows
});
module.exports = {
init: init,
- monitor: monitor
+ monitor: monitor,
};
diff --git a/lib/utils.js b/lib/utils.js
index 228aadb..8d79d61 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -1,21 +1,21 @@
var utils = {};
utils.humanFileSize = function(bytes, isDecimal) {
- isDecimal = typeof isDecimal !== "undefined" ? isDecimal : false;
+ isDecimal = typeof isDecimal !== 'undefined' ? isDecimal : false;
if (bytes == 0) {
- return "0.00 B";
+ return '0.00 B';
}
var base = isDecimal ? 1000 : 1024;
var e = Math.floor(Math.log(bytes) / Math.log(base));
return (
(bytes / Math.pow(base, e)).toFixed(2) +
- " " +
- " KMGTP".charAt(e) +
- (isDecimal || e == 0 ? "" : "i") +
- "B"
+ ' ' +
+ ' KMGTP'.charAt(e) +
+ (isDecimal || e == 0 ? '' : 'i') +
+ 'B'
);
};
-utils.colors = ["magenta", "cyan", "blue", "yellow", "green", "red"];
+utils.colors = ['magenta', 'cyan', 'blue', 'yellow', 'green', 'red'];
module.exports = utils;
diff --git a/package.json b/package.json
index 2cc47aa..51b7fe5 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"scripts": {
"test": "echo \"Test will be implemented.\" && exit 0",
"start": "./bin/gtop",
- "lint": "prettier --single-quote --trailing-comma es5 --write lib/**/*"
+ "lint": "prettier --single-quote --trailing-comma es5 --write 'lib/**/*.js'"
},
"repository": {
"type": "git",