commandDispatcher: try 4

This commit is contained in:
Cynthia Foxwell 2022-12-10 15:32:55 -07:00
parent a8310dda03
commit 606eaf0185

View file

@ -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) === "-") {