Permalink
Browse files

Restructure, add optimist

  • Loading branch information...
1 parent 8f46cb2 commit 2a35db8a3b6262857a4bb6eeaf1db3154aca7caf @mixu committed Jul 25, 2013
View
@@ -0,0 +1 @@
+node_modules/
View
27 find-git.js → bin/gr 100644 → 100755
@@ -1,7 +1,27 @@
#!/usr/bin/env node
var path = require('path'),
- List = require('./list.js'),
- exec = require('./run.js');
+ List = require('../lib/list.js'),
+ exec = require('../lib/run.js'),
+ style = require('../lib/style.js'),
+ opts = require('optimist')
+ .usage('Usage: $0 --include <file/dir ...> --out filename.js')
+ .options({
+ 'version': {
+ describe: 'Version info'
+ }
+ });
+ argv = opts.parse(process.argv);
+
+if(argv['version'] || argv['v'] ) {
+ console.log(require('../package.json').version);
+ process.exit();
+}
+
+if(argv['help']) {
+ console.log(opts.help());
+ process.exit();
+}
+
var homePath = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
task = 'git -c color.status=always status -sb';
@@ -24,7 +44,8 @@ list.add(homePath);
list.files.forEach(function(file) {
var cwd = path.dirname(file.name);
tasks.push(function(onDone) {
- console.log('\nin '+cwd+'\n');
+ console.log(style('\nin ' +path.dirname(cwd) + path.sep, 'gray') + style(path.basename(cwd), 'white') + '\n');
+ // console.log('\nin '+cwd+'\n');
exec(task, cwd, onDone);
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -23,7 +23,9 @@
"url": "https://github.com/mixu/gr/issues"
},
"bin": {
- "gr": "./find-git.js"
+ "gr": "./bin/gr"
},
- "dependencies": {}
+ "dependencies": {
+ "optimist": "~0.6.0"
+ }
}

0 comments on commit 2a35db8

Please sign in to comment.