Permalink
Browse files

[lib] trunc long strings, added arrows. [dist] new screenshot

  • Loading branch information...
1 parent 91ae417 commit 500daee8e833d8aafdf97c8b1f54f955b2e01588 Paolo Fragomeni committed Apr 20, 2012
Showing with 33 additions and 3 deletions.
  1. +8 −2 cdir.js
  2. +25 −1 example/example.js
  3. BIN screenshot.png
View
10 cdir.js
@@ -91,6 +91,10 @@ var constructMeta = function constructMeta(parentType, depth, node, itemPrefix)
switch(type) {
case 'string':
+ if (node.length > process.stdout.getWindowSize()[0]/2) {
+ node = node.substr(0, process.stdout.getWindowSize()[0]/2) + '...';
+ }
+
meta.push({
description: itemPrefix + '\033[31m"' + node + '"\033[0m',
expanded: false,
@@ -132,7 +136,7 @@ var constructMeta = function constructMeta(parentType, depth, node, itemPrefix)
case 'array':
meta.push({
- description: itemPrefix + '\033[36mArray[\033[0m' + node.length + '\033[36m]\033[0m',
+ description: itemPrefix + '\033[36mArray[\033[0m' + node.length + '\033[36m]\033[0m',
expanded: false,
displayed: first,
type: type,
@@ -154,7 +158,7 @@ var constructMeta = function constructMeta(parentType, depth, node, itemPrefix)
case 'object':
meta.push({
- description: itemPrefix + '\033[36mObject\033[0m',
+ description: itemPrefix + '\033[36mObject\033[0m',
expanded: false,
displayed: first,
type: type,
@@ -243,6 +247,7 @@ var listener = function listener(chunk, key) {
if (meta[index].expanded) {
+ meta[index].description = meta[index].description.replace('', '');
meta[index].expanded = false;
for (var i = index, l = stop; i < l; i++) {
@@ -260,6 +265,7 @@ var listener = function listener(chunk, key) {
}
else {
+ meta[index].description = meta[index].description.replace('', '');
meta[index].expanded = true;
for (var i = index, l = stop; i < l; i++) {
View
@@ -13,7 +13,7 @@ var stuff = {
"prompt"
],
"version" : "0.0.1",
- "author" : "Paolo Fragomeni <paolo@nodejisu.com>",
+ "author" : "Paolo Fragomeni <paolo@nodejitsu.com>",
"repository" : {
"type" : "git",
"url" : "http://github.com/hij1nx/node-dir.git"
@@ -25,6 +25,30 @@ var stuff = {
"main" : "./dir",
"scripts": {
"test": "node tests/test.js"
+ },
+ "a" : "dir",
+ "descsription" : "An interactive console.dir() for the terminal.",
+ "tasgs" : [
+ "console",
+ "debug",
+ "debugging",
+ "json",
+ "interacive",
+ "prompt"
+ ],
+ "vsersion" : "0.0.1",
+ "asuthor" : "Paolo Fragomeni <paolo@nodejitsu.com>Paolo Fragomeni <paolo@nodejitsu.com>Paolo Fragomeni <paolo@nodejitsu.com>Paolo Fragomeni <paolo@nodejitsu.com>Paolo Fragomeni <paolo@nodejitsu.com>",
+ "rsepository" : {
+ "type" : "git",
+ "url" : "http://github.com/hij1nx/node-dir.git"
+ },
+ "bugss" : {
+ "url" : "http://github.com/hij1nx/node-dir/issues"
+ },
+ "ensgines" : ["node >= 0.6.x"],
+ "masin" : "./dir",
+ "sscripts": {
+ "test": "node tests/test.js"
}
};
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 500daee

Please sign in to comment.