Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pixl-cli

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixl-cli - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

44

cli.js

@@ -7,2 +7,3 @@ // Tools for writing command-line apps in Node.

var readline = require('readline');
var path = require('path');
var chalk = require('chalk');

@@ -167,2 +168,41 @@ var stringWidth = require('string-width');

tree: function(dir, indent, args) {
// render dir/file tree view based on array of files/dirs
var self = this;
if (!dir) dir = ".";
if (!indent) indent = "";
if (!args) args = {};
var output = [];
args.folderStyles = args.folderStyles || ["bold", "yellow"];
args.fileStyles = args.fileStyles || ["green"];
args.symlinkStyles = args.symlinkStyles || ["purple"];
args.lineStyles = args.lineStyles || ["gray"];
if (!indent) {
output.push( this.applyStyles( path.basename(dir) + "/", args.folderStyles ) );
}
fs.readdirSync(dir).forEach( function(filename, idx, arr) {
var file = path.join( dir, filename );
var stats = fs.statSync(file);
var last = (idx == arr.length - 1);
var prefix = indent + self.applyStyles( " " + (last ? "└" : "├"), args.lineStyles ) + " ";
if (stats.isDirectory()) {
output.push( prefix + self.applyStyles(filename + "/", args.folderStyles) );
var results = self.tree(file, indent + self.applyStyles( last ? " " : " │", args.lineStyles ) + " ", args );
if (results) output.push( results );
}
else if (stats.isSymbolicLink()) {
output.push( prefix + self.applyStyles(filename, args.symlinkStyles) );
}
else {
output.push( prefix + self.applyStyles(filename, args.fileStyles) );
}
} );
return output.length ? output.join("\n") : "";
},
table: function(rows, args) {

@@ -364,3 +404,3 @@ // render table of cols/rows with unicode borders

// hide CLI cursor
process.stdout.write('\u001b[?25l');
cli.print('\u001b[?25l');

@@ -491,3 +531,3 @@ // just in case

// restore CLI cursor
process.stdout.write('\u001b[?25h');
cli.print('\u001b[?25h');
}

@@ -494,0 +534,0 @@ } // progress

2

package.json
{
"name": "pixl-cli",
"version": "1.0.0",
"version": "1.0.1",
"description": "Tools for building command-line apps for Node.js.",

@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>",

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