From 0f4d9caaeabcac17195cbb8e4370602214da99a8 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Wed, 16 May 2018 14:57:02 +0200 Subject: [PATCH] [BETA] Fix small bug CLI (#110) * Make parityArgv simpler * Bump to 0.2.4 --- electron/cli/index.js | 13 +++++++++---- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/electron/cli/index.js b/electron/cli/index.js index d6b2097f8..50cc38e98 100644 --- a/electron/cli/index.js +++ b/electron/cli/index.js @@ -66,21 +66,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-', '')); if (cli[previousKey] === item) { diff --git a/package-lock.json b/package-lock.json index a80cb7f77..f10e2f6b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "parity-ui", - "version": "0.2.3", + "version": "0.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3402ce6c3..f0f2bfa74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parity-ui", - "version": "0.2.3", + "version": "0.2.4", "description": "The Electron app for Parity UI", "main": ".build/electron.js", "jsnext:main": ".build/electron.js",