commandDispatcher: try 4
This commit is contained in:
parent
a8310dda03
commit
606eaf0185
1 changed files with 3 additions and 3 deletions
|
@ -26,13 +26,13 @@ function parseAsArgv(argv) {
|
||||||
const args = [];
|
const args = [];
|
||||||
|
|
||||||
for (const arg of argv) {
|
for (const arg of argv) {
|
||||||
const equalsIndex = arg.indexOf("=");
|
const equalsIndex = arg.charAt(0) === "-" ? arg.indexOf("=") : -1;
|
||||||
const argName =
|
const argName =
|
||||||
equalsIndex === -1 && arg.charAt(0) !== "-"
|
equalsIndex === -1
|
||||||
? removeStartHyphens(arg)
|
? removeStartHyphens(arg)
|
||||||
: removeStartHyphens(arg.slice(0, equalsIndex));
|
: removeStartHyphens(arg.slice(0, equalsIndex));
|
||||||
|
|
||||||
if (equalsIndex !== -1 && arg.charAt(0) === "-") {
|
if (equalsIndex !== -1) {
|
||||||
optional[argName] = convertIfApplicable(arg.slice(equalsIndex + 1));
|
optional[argName] = convertIfApplicable(arg.slice(equalsIndex + 1));
|
||||||
} else if (arg.charAt(0) === "-") {
|
} else if (arg.charAt(0) === "-") {
|
||||||
if (arg.charAt(1) === "-") {
|
if (arg.charAt(1) === "-") {
|
||||||
|
|
Loading…
Reference in a new issue