[Pkg-javascript-commits] [node-browser-unpack] 05/40: usage and -h

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 12:27:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browser-unpack.

commit c7d84375f2fcd8cc2041a74a8943410472b20ab6
Author: James Halliday <mail at substack.net>
Date:   Mon Dec 23 20:44:54 2013 -0800

    usage and -h
---
 bin/cmd.js    | 14 ++++++++++++++
 bin/usage.txt |  5 +++++
 2 files changed, 19 insertions(+)

diff --git a/bin/cmd.js b/bin/cmd.js
index 15e10e7..75a3319 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -2,9 +2,23 @@
 
 var parse = require('../');
 var concat = require('concat-stream');
+var fs = require('fs');
+
+var minimist = require('minimist');
+var argv = minimist(process.argv.slice(2));
+if (argv.help || argv.h) {
+    return fs.createReadStream(__dirname + '/usage.txt')
+        .pipe(process.stdout)
+    ;
+}
 
 process.stdin.pipe(concat(function (body) {
     var rows = parse(body);
+    if (!rows) {
+        console.error("couldn't parse this bundle");
+        process.exit(1);
+    }
+    
     console.log('[');
     rows.forEach(function (row, index) {
         if (index > 0) console.log(',');
diff --git a/bin/usage.txt b/bin/usage.txt
new file mode 100644
index 0000000..a49f53b
--- /dev/null
+++ b/bin/usage.txt
@@ -0,0 +1,5 @@
+usage: browser-unpack
+
+  Write a browser bundle to STDIN.
+  Outputs a JSON array in the module-deps format.
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-unpack.git



More information about the Pkg-javascript-commits mailing list