commandDispatcher: try 4

This commit is contained in:
Cynthia Foxwell 2022-12-10 15:32:55 -07:00
parent a8310dda03
commit 606eaf0185
1 changed files with 3 additions and 3 deletions

View File

@ -26,13 +26,13 @@ function parseAsArgv(argv) {
const args = [];
for (const arg of argv) {
const equalsIndex = arg.indexOf("=");
const equalsIndex = arg.charAt(0) === "-" ? arg.indexOf("=") : -1;
const argName =
equalsIndex === -1 && arg.charAt(0) !== "-"
equalsIndex === -1
? removeStartHyphens(arg)
: removeStartHyphens(arg.slice(0, equalsIndex));
if (equalsIndex !== -1 && arg.charAt(0) === "-") {
if (equalsIndex !== -1) {
optional[argName] = convertIfApplicable(arg.slice(equalsIndex + 1));
} else if (arg.charAt(0) === "-") {
if (arg.charAt(1) === "-") {