Comparing version 0.0.15 to 0.0.16
47
index.js
@@ -56,22 +56,6 @@ var chalk = require("chalk"); | ||
this.width = opts.width || 80; | ||
barclis.push(this); | ||
resize(opts.width || process.stdout.columns); | ||
// Update our labels so the formatting is consistent | ||
barclis.forEach(function(barcli, index) { | ||
// Make sure the labels are laft padded with spaces | ||
while (barcli.label.length < maxLabelLength) { | ||
barcli.label = " " + barcli.label; | ||
} | ||
// Output the label | ||
process.stdout.write("\033["+String(barcli.index+1)+";0H"); | ||
process.stdout.write(chalk[barcli.color](barcli.label + ": ")); | ||
process.stdout.write(chalk.white("|\n")); | ||
}); | ||
} | ||
@@ -82,2 +66,7 @@ | ||
if (String(data).length > maxValueLength) { | ||
maxValueLength = String(data).length; | ||
resize(process.stdout.columns); | ||
} | ||
var raw = data; | ||
@@ -147,2 +136,26 @@ | ||
process.stdout.on('resize', function() { | ||
resize(process.stdout.columns); | ||
}); | ||
var resize = function(size) { | ||
// Update our labels so the formatting is consistent | ||
barclis.forEach(function(barcli, index) { | ||
// Make sure the labels are laft padded with spaces | ||
while (barcli.label.length < maxLabelLength) { | ||
barcli.label = " " + barcli.label; | ||
} | ||
barcli.width = size - maxLabelLength - maxValueLength - 10; | ||
// Output the label | ||
process.stdout.write("\033["+String(barcli.index+1)+";0H"); | ||
process.stdout.write(chalk[barcli.color](barcli.label + ": ")); | ||
process.stdout.write(chalk.white("|\n")); | ||
}); | ||
}; | ||
module.exports = Barcli; |
{ | ||
"name": "barcli", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "A simple tool for displaying real time bar graphs in the console", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10385
118