[Pkg-javascript-commits] [uglifyjs] 107/491: improve CLI usability (#2016)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:26 UTC 2018


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

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit fec14379f6bae209484d75ba1db5c6b5ee37ae5a
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sun May 28 04:09:40 2017 +0800

    improve CLI usability (#2016)
    
    Report supported options upon invalid option syntax.
    
    fixes #1883
---
 bin/uglifyjs      | 2 +-
 test/mocha/cli.js | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/uglifyjs b/bin/uglifyjs
index 8ea7d16..158dc57 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -351,7 +351,7 @@ function parse_js(flag, constants) {
                 }
             }));
         } catch(ex) {
-            fatal("Error parsing arguments for '" + flag + "': " + value);
+            options[value] = null;
         }
         return options;
     }
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index 565b606..4234f2f 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -537,4 +537,13 @@ describe("bin/uglifyjs", function () {
             done();
         });
     });
+    it("Should print supported options on invalid option syntax", function(done) {
+        var command = uglifyjscmd + " test/input/comments/filter.js -b ascii-only";
+        exec(command, function (err, stdout, stderr) {
+            assert.ok(err);
+            assert.strictEqual(stdout, "");
+            assert.ok(/^Supported options:\n\{[^}]+}\nERROR: `ascii-only` is not a supported option/.test(stderr), stderr);
+            done();
+        });
+    });
 });

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



More information about the Pkg-javascript-commits mailing list