Comparing version 0.0.8 to 0.0.9
27
cdir.js
@@ -19,2 +19,3 @@ | ||
var lastIndex = 0; | ||
var linemode = false; | ||
@@ -280,5 +281,13 @@ var meta = [], map = [0]; | ||
write('\033[30;47m'); | ||
write(meta[i].description.replace(/\033\[[0-9;]*m/g, '') + '\n'); | ||
if (linemode === true) { | ||
write(meta[i].index + ': ' + meta[i].description.replace(/\033\[[0-9;]*m/g, '') + '\n'); | ||
} | ||
else { | ||
write(meta[i].description.replace(/\033\[[0-9;]*m/g, '') + '\n'); | ||
} | ||
write('\033[0m'); | ||
} | ||
else if (linemode === true) { | ||
write(meta[i].index + ': ' + meta[i].description + '\n'); | ||
} | ||
else { | ||
@@ -368,3 +377,3 @@ write(meta[i].description + '\n'); | ||
// | ||
if (chunk === '/') { | ||
if (chunk === '/' && searchmode === false) { | ||
@@ -509,3 +518,3 @@ searchmode = true; | ||
} | ||
else if (searchmode === true) { | ||
else if (searchmode === true && typeof(chunk) !== 'undefined') { | ||
@@ -560,3 +569,3 @@ write(chunk); | ||
if (key.name === 'q' || key.ctrl && key.name === 'q') { | ||
if (key.name === 'q' || key.ctrl && key.name === 'c') { | ||
stdin.removeListener('keypress', listener); | ||
@@ -567,2 +576,12 @@ stdin.pause(); | ||
} | ||
// | ||
// Toggle for linemode | ||
// | ||
if (chunk === ':' && searchmode === false) { | ||
linemode ? linemode = false : linemode = true; | ||
up(displayed); | ||
renderMeta(); | ||
} | ||
}; | ||
@@ -569,0 +588,0 @@ |
@@ -9,5 +9,6 @@ { | ||
"json", | ||
"interactive", | ||
"prompt" | ||
], | ||
"version" : "0.0.8", | ||
"version" : "0.0.9", | ||
"author" : "Paolo Fragomeni <paolo@nodejisu.com>", | ||
@@ -14,0 +15,0 @@ "repository" : { |
@@ -5,16 +5,27 @@ # Synopsis | ||
# Motivation | ||
Why? Sometimes you have a lot of data that gets dumped to the screen. It's hard to keep track of it visually. A lot of the time you are just looking for one item in a sea of data. Progressive disclosure helps. | ||
Reading big object dumps is a waste of time. Progressive disclosure helps. | ||
# Features | ||
- Searchable/Repeat search | ||
- Handles cyclical references | ||
- Expand and collapse nodes | ||
# Usage | ||
## Navigation | ||
First, require the module. Then use `console.dir(somecode)` in your program and then use `tab` or `shift+tab` to cycle through the object's members. You can hit `space`, `return` or `enter` to expand a member. See the example below. | ||
## Install | ||
Do `npm install cdir -g` and then require the module in your program like this `console.dir = require('cdir')`. | ||
## Searching throught JSON | ||
## Navigate | ||
Use `console.dir(someobject)` somewhere in your program and then hit `tab`, `shift+tab` or the arrow keys to cycle through the object's members. You can hit `space`, `return` or `enter` to expand a member. | ||
## Search | ||
Search by pressing the `/` key. This will display a `/` prompt. If you have already searched for something it will be displayed before the `/` prompt. For instance if you searched for "foobar" it would appear as `(foobar) /`. | ||
## How to quit | ||
## Line Numbers | ||
You can add comprehensive line numbers by pressing `:` while not in search mode. These line numbers include collapsed nodes so expanding one will not change numbers of later items. | ||
## Quit | ||
Hit `ctrl+c` or `q` to quit! | ||
## An example | ||
## Simple Example | ||
There is a CLI version too if you want to use it. `npm install cdir -g`. | ||
@@ -21,0 +32,0 @@ |
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
110262
661
60