bin/pegjs: Order options in a switch statement alphabetically

redux
David Majda 8 years ago
parent ff330a0d4b
commit 0a2217d3da

@ -120,22 +120,18 @@ var options = {
while (args.length > 0 && isOption(args[0])) {
switch (args[0]) {
case "-o":
case "--output":
case "--allowed-start-rules":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the -o/--output option.");
abort("Missing parameter of the -e/--allowed-start-rules option.");
}
outputFile = args[0];
options.allowedStartRules = args[0]
.split(",")
.map(trim);
break;
case "-e":
case "--export-var":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the -e/--export-var option.");
}
options.exportVar = args[0];
case "--cache":
options.cache = true;
break;
case "-d":
@ -152,22 +148,40 @@ while (args.length > 0 && isOption(args[0])) {
}
break;
case "--cache":
options.cache = true;
case "-e":
case "--export-var":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the -e/--export-var option.");
}
options.exportVar = args[0];
break;
case "--allowed-start-rules":
case "--extra-options":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the -e/--allowed-start-rules option.");
abort("Missing parameter of the --extra-options option.");
}
options.allowedStartRules = args[0]
.split(",")
.map(trim);
addExtraOptions(options, args[0]);
break;
case "--trace":
options.trace = true;
case "--extra-options-file":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the --extra-options-file option.");
}
try {
var json = fs.readFileSync(args[0]);
} catch(e) {
abort("Can't read from file \"" + args[0] + "\".");
}
addExtraOptions(options, json);
break;
case "-h":
case "--help":
printHelp();
exitSuccess();
break;
case "-O":
@ -182,6 +196,15 @@ while (args.length > 0 && isOption(args[0])) {
options.optimize = args[0];
break;
case "-o":
case "--output":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the -o/--output option.");
}
outputFile = args[0];
break;
case "--plugin":
nextArg();
if (args.length === 0) {
@ -199,25 +222,8 @@ while (args.length > 0 && isOption(args[0])) {
options.plugins.push(mod);
break;
case "--extra-options":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the --extra-options option.");
}
addExtraOptions(options, args[0]);
break;
case "--extra-options-file":
nextArg();
if (args.length === 0) {
abort("Missing parameter of the --extra-options-file option.");
}
try {
var json = fs.readFileSync(args[0]);
} catch(e) {
abort("Can't read from file \"" + args[0] + "\".");
}
addExtraOptions(options, json);
case "--trace":
options.trace = true;
break;
case "-v":
@ -226,12 +232,6 @@ while (args.length > 0 && isOption(args[0])) {
exitSuccess();
break;
case "-h":
case "--help":
printHelp();
exitSuccess();
break;
case "--":
nextArg();
break;

Loading…
Cancel
Save