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

Commit

Permalink
[BETA] Fix small bug CLI (#110)
Browse files Browse the repository at this point in the history
* Make parityArgv simpler

* Bump to 0.2.4
  • Loading branch information
amaury1093 authored and jacogr committed May 16, 2018
1 parent bf9ba71 commit 0f4d9ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions electron/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 0f4d9ca

Please sign in to comment.