commandDispatcher: try 3

This commit is contained in:
Cynthia Foxwell 2022-12-10 15:31:36 -07:00
parent d920d334a2
commit a8310dda03

View file

@ -16,7 +16,7 @@ function convertIfApplicable(val) {
} }
function removeStartHyphens(val) { function removeStartHyphens(val) {
return val.replace(/^-+/g, ""); return val.replace(/^--?/g, "");
} }
// taken from ethanent/gar // taken from ethanent/gar
@ -28,7 +28,7 @@ function parseAsArgv(argv) {
for (const arg of argv) { for (const arg of argv) {
const equalsIndex = arg.indexOf("="); const equalsIndex = arg.indexOf("=");
const argName = const argName =
equalsIndex === -1 && arg.charAt(0) === "-" equalsIndex === -1 && arg.charAt(0) !== "-"
? removeStartHyphens(arg) ? removeStartHyphens(arg)
: removeStartHyphens(arg.slice(0, equalsIndex)); : removeStartHyphens(arg.slice(0, equalsIndex));