[Pkg-javascript-commits] [node-acorn-jsx] 184/484: Clean up previous patch
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20: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-acorn-jsx.
commit 5dcd50447baa40016e1c97160e6c7428f3bfb1c9
Author: Marijn Haverbeke <marijnh at gmail.com>
Date: Thu May 15 10:38:28 2014 +0200
Clean up previous patch
Issue #100
---
bin/acorn | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/bin/acorn b/bin/acorn
index f70fe21..a3d05f4 100755
--- a/bin/acorn
+++ b/bin/acorn
@@ -4,13 +4,10 @@ var path = require("path");
var fs = require("fs");
var acorn = require("../acorn.js");
-var infile, infilecount = 0;
-var options = {}, silent = false, compact = false;
-var parsed;
+var infile, parsed, options = {}, silent = false, compact = false;
function help(status) {
- // we want to print to stderr, not stdout, on errors.
- var print = (status == 0) ? console.out : console.err;
+ var print = (status == 0) ? console.out : console.error;
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5] [--strictSemicolons]");
print(" [--locations] [--compact] [--silent] [--help] [--] infile");
process.exit(status);
@@ -18,16 +15,8 @@ function help(status) {
for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i];
- if (arg[0] != "-") {
- infile = arg;
- ++infilecount;
- continue;
- } else if (arg == "--") {
- if (i < process.argv.length - 2) help(1); // we have too many remaining `infile`s
- infile = process.argv[i + 1]; // we want the *next* argument, not the current one
- ++infilecount;
- break;
- }
+ if (arg[0] != "-" && !infile) infile = arg;
+ else if (arg == "--" && !infile && i + 2 == process.argv.length) infile = process.argv[++i];
else if (arg == "--ecma3") options.ecmaVersion = 3;
else if (arg == "--ecma5") options.ecmaVersion = 5;
else if (arg == "--strictSemicolons") options.strictSemicolons = true;
@@ -35,12 +24,9 @@ for (var i = 2; i < process.argv.length; ++i) {
else if (arg == "--silent") silent = true;
else if (arg == "--compact") compact = true;
else if (arg == "--help") help(0);
- else help(1); // we already took care of all arguments without a starting dash
+ else help(1);
}
-// test against counter: we want exactly 1 file. Any more or less should error.
-if (infilecount !== 1) help(1);
-
try {
var code = fs.readFileSync(infile, "utf8");
parsed = acorn.parse(code, options);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list