toggleString args now additionally accept just input value, taking first option as default.

This commit is contained in:
d98762625 2018-08-31 13:45:12 +01:00
parent f6c4b5073c
commit 7c9ebafd00
2 changed files with 32 additions and 3 deletions

View file

@ -75,9 +75,13 @@ function transformArgs(originalArgs, newArgs) {
if (index > -1) {
const argument = allArgs[index];
if (["toggleString"].indexOf(argument.type) > -1) {
argument.string = newArgs[key].string;
argument.option = newArgs[key].option;
if (argument.type === "toggleString") {
if (typeof newArgs[key] === "string") {
argument.string = newArgs[key];
} else {
argument.string = newArgs[key].string;
argument.option = newArgs[key].option;
}
} else if (argument.type === "editableOption") {
// takes key: "option", key: {name, val: "string"}, key: {name, val: [...]}
argument.value = typeof newArgs[key] === "string" ? newArgs[key]: newArgs[key].value;