Permalink
Browse files

command-line toolage

  • Loading branch information...
1 parent 965fc93 commit 0854e16e3be380cec7f1a53e74f0ced899ba305e @substack committed Jun 14, 2012
Showing with 31 additions and 3 deletions.
  1. +21 −0 bin/cmd.js
  2. +7 −0 bin/usage.txt
  3. +1 −1 index.js
  4. +1 −1 test/files/a.txt.js
  5. +1 −1 test/files/b.txt.js
View
@@ -0,0 +1,21 @@
+#!/usr/bin/env node
+var exportify = require('../');
+var argv = require('optimist').boolean(['v','verbose']).argv;
+var files = argv._;
+var fs = require('fs');
+
+if (!files.length || argv.h || argv.help) {
+ var s = fs.createReadStream(__dirname + '/usage.txt');
+ s.pipe(process.stderr);
+ s.on('end', function () {
+ process.exit(1);
+ });
+ return;
+}
+
+var ex = exportify(files);
+if (argv.v || argv.verbose) {
+ ex.on('export', function (file) {
+ console.log(file);
+ });
+}
View
@@ -0,0 +1,7 @@
+Usage: exportify OPTIONS [files]
+
+ OPTIONS:
+ -h, --help show this message
+ -e, --ext only exportify files with this extension
+ -v, --verbose log a message for every file written
+
View
@@ -26,7 +26,7 @@ module.exports = function (files, opts) {
ws.write(s);
});
rs.on('end', function () {
- ws.end('"');
+ ws.end('"\n');
emitter.emit('export', file);
if (--pending === 0) emitter.emit('end');
});
View
@@ -1 +1 @@
-module.exports="beep\n"
+module.exports="beep\n"
View
@@ -1 +1 @@
-module.exports="boop\n"
+module.exports="boop\n"

0 comments on commit 0854e16

Please sign in to comment.