Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit 0f4d9ca

Browse files
amaury1093jacogr
authored andcommitted
[BETA] Fix small bug CLI (#110)
* Make parityArgv simpler * Bump to 0.2.4
1 parent bf9ba71 commit 0f4d9ca

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

electron/cli/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,26 @@ const camelcase = flag =>
6666
// Now we must think which arguments passed to cli must be passed down to
6767
// parity.
6868
const parityArgv = cli.rawArgs
69-
.splice(Math.max(cli.rawArgs.findIndex(item => item.startsWith('--'))), 0) // Remove all arguments until one --option
69+
.splice(2) // Remove first 2 arguments which are program path
7070
.filter((item, index, array) => {
71-
const key = camelcase(item.replace('--', '').replace('no-', '')); // Remove first 2 '--' and then camelCase
71+
const key = camelcase(item.replace('--', '').replace('no-', '')); // Remove '--' and then camelCase
7272

7373
if (key in cli) {
74-
// If the option is consumed by commander.js, then we skip it
74+
// If the option is consumed by commander.js, then we don't pass down to parity
7575
return false;
7676
}
7777

7878
// If it's not consumed by commander.js, and starts with '--', then we keep
79-
// it. This step is optional, used for optimization only.
79+
// it.
8080
if (item.startsWith('--')) {
8181
return true;
8282
}
8383

84+
// If it's the 1st argument and did not start with --, then we skip it
85+
if (index === 0) {
86+
return false;
87+
}
88+
8489
const previousKey = camelcase(array[index - 1].replace('--', '').replace('no-', ''));
8590

8691
if (cli[previousKey] === item) {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parity-ui",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "The Electron app for Parity UI",
55
"main": ".build/electron.js",
66
"jsnext:main": ".build/electron.js",

0 commit comments

Comments
 (0)