Skip to content
Permalink
Browse files

fix(initializer): fix bad logic RE argument parsing from the top leve…

…l forge command

ISSUES CLOSED: #237
  • Loading branch information
MarshallOfSound committed May 26, 2017
1 parent 8449fb1 commit 774b8769399e99a3fcd31d236d143dd232e12048
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/electron-forge.js
@@ -10,11 +10,19 @@ import config from './util/config';

const originalSC = program.executeSubCommand.bind(program);
program.executeSubCommand = (argv, args, unknown) => {
let newArgs = [].concat(args[0]).concat(unknown);
if (args.length > 1) {
newArgs = args.concat('--').concat(args.slice(1));
let indexOfDoubleDash = process.argv.indexOf('--');
indexOfDoubleDash = indexOfDoubleDash < 0 ? process.argv.length + 1 : indexOfDoubleDash;

const passThroughArgs = args.filter(arg => process.argv.indexOf(arg) > indexOfDoubleDash);
const normalArgs = args.filter(arg => process.argv.indexOf(arg) <= indexOfDoubleDash);

let newArgs = args;
let newUnknown = unknown;
if (passThroughArgs.length > 0) {
newArgs = normalArgs.concat(unknown).concat('--').concat(passThroughArgs);
newUnknown = [];
}
return originalSC(argv, newArgs, []);
return originalSC(argv, newArgs, newUnknown);
};

program

0 comments on commit 774b876

Please sign in to comment.
You can’t perform that action at this time.