diff --git a/electron/cli/index.js b/electron/cli/index.js index 498a5a394e64940ca534e073cd8873fe6fdf7cf7..bb1ba7f5f7f3675474ad3d9beb30e3b7121ad0c8 100644 --- a/electron/cli/index.js +++ b/electron/cli/index.js @@ -55,21 +55,26 @@ const camelcase = flag => // Now we must think which arguments passed to cli must be passed down to // parity. const parityArgv = cli.rawArgs - .splice(Math.max(cli.rawArgs.findIndex(item => item.startsWith('--')), 0)) // Remove all arguments until one --option + .splice(2) // Remove first 2 arguments which are program path .filter((item, index, array) => { - const key = camelcase(item.replace('--', '').replace('no-', '')); // Remove first 2 '--' and then camelCase + const key = camelcase(item.replace('--', '').replace('no-', '')); // Remove '--' and then camelCase if (key in cli) { - // If the option is consumed by commander.js, then we skip it + // If the option is consumed by commander.js, then we don't pass down to parity return false; } // If it's not consumed by commander.js, and starts with '--', then we keep - // it. This step is optional, used for optimization only. + // it. if (item.startsWith('--')) { return true; } + // If it's the 1st argument and did not start with --, then we skip it + if (index === 0) { + return false; + } + const previousKey = camelcase( array[index - 1].replace('--', '').replace('no-', '') ); diff --git a/electron/index.js b/electron/index.js index c35eb361ca0a9e47b3bff7160f8c32f298323ffd..8342dde7facd29dd9785e004fba5fa45024c3e61 100644 --- a/electron/index.js +++ b/electron/index.js @@ -8,7 +8,7 @@ const path = require('path'); const url = require('url'); const addMenu = require('./menu'); -const cli = require('./cli'); +const { cli } = require('./cli'); const doesParityExist = require('./operations/doesParityExist'); const fetchParity = require('./operations/fetchParity'); const handleError = require('./operations/handleError');