Skip to content

Commit

Permalink
fixes nodeman
Browse files Browse the repository at this point in the history
  • Loading branch information
nanha committed Mar 31, 2012
1 parent f4a6ce8 commit aa05212
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 40 deletions.
51 changes: 13 additions & 38 deletions deps/nodeman/bin/nodeman
Expand Up @@ -14,16 +14,25 @@ var colors = require('colors'),
path = require('path'),
fs = require('fs');

/**
* console.error && process exit
*/
function abort(str) {
console.log('\033[2J');
console.error(str.toString().red);
process.exit(1);
}

/**
* usage
*/
var usage = ''
+ '\n'
+ ' Usage: nodeman [module_name]\n'.yellow
+ '\n'
+ ' Options:\n'
+ ' -b, --builtin show module_name list\n'
+ ' -h, --help output help information\n'
+ ' Options:\n'.cyan
+ ' -b, --builtin show module_name list\n'.cyan
+ ' -h, --help output help information\n'.cyan
;

/**
Expand All @@ -45,8 +54,7 @@ while (args.length) {
break;
case '-b':
case '--builtin':
nodeman.builtin();
return;
return nodeman.builtin();
break;
default:
moduleName = arg;
Expand All @@ -56,36 +64,3 @@ while (args.length) {
break;
}
}

/**
* builtin list
*
* @return void
*/
function builtin() {
var docs = path.resolve(__dirname, '..', 'docs');
fs.readdir(docs, function(err, files) {
if (err) throw new Error(err);

var __builtin__ = [];
files.forEach(function(file) {
if (!/_doc/.test(file)) return;

__builtin__.push(file.replace(/_doc.js/g, ''));
});

//console.log('\033[2J');
console.log(' Current embed moduleName list'.red);
console.log(' --------------------------------');
console.log();
console.log(' ' + __builtin__.join(', '));
console.log();
});
}
/**
* console.error && process exit
*/
function abort(str) {
console.error(str);
process.exit(1);
}
5 changes: 4 additions & 1 deletion deps/nodeman/lib/nodeman.js
Expand Up @@ -55,7 +55,10 @@ function builtin() {
console.log(' Current embed moduleName list'.red);
console.log(' --------------------------------');
console.log();
console.log(' ' + __builtin__.join(', '));
console.log(' usage: nodeman [moduleName]'.yellow);
console.log();
console.log(' ' + __builtin__.join(', ').cyan);
console.log();
console.log();
});
}
Expand Down
2 changes: 1 addition & 1 deletion deps/nodeman/package.json
Expand Up @@ -3,7 +3,7 @@
"name": "nodeman",
"description": "Executable Node.js User's Colorful Manual for Command-line.",
"homepage": "http://nodeqa.com",
"version": "0.1.2",
"version": "0.1.3",
"repository": {
"type": "git",
"url": "git://github.com/nanha/nodeman.git"
Expand Down

0 comments on commit aa05212

Please sign in to comment.