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

[BETA] Fix small bug CLI #110

Merged
merged 2 commits into from
May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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