From f3a04d1ed339d0442d0da6a9e89435af8a52612a Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Sun, 3 Nov 2013 23:00:51 +0100 Subject: [PATCH] fix that multiple command line arguments can get passed test case: add a --option-file and activate pretty print output. It will break because the loop only runs once through the switch before checking for two remaining arguments. Both pretty print and --option-file have to get processed inside the switch. --- Jade.lrplugin/jade_compiler.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Jade.lrplugin/jade_compiler.js b/Jade.lrplugin/jade_compiler.js index 05fba4d6..88bcbc54 100755 --- a/Jade.lrplugin/jade_compiler.js +++ b/Jade.lrplugin/jade_compiler.js @@ -41,8 +41,8 @@ var usage = '' var arg , infile , outfile; -while (args.length) { - arg = args.shift(); +for(var i=0; i (args.length-2)) { + console.error('exactly 2 file names must be specified'); + process.exit(1); + } + infile = args[i]; + outfile = args[++i]; break; } - if (args.length != 2) { - console.error('exactly 2 file names must be specified'); - process.exit(1); - } - infile = args.shift(); - outfile = args.shift(); } renderJade(infile, outfile);