feat: boolean type support finally

This commit is contained in:
MihailRis
2024-10-14 19:38:30 +03:00
parent b9074ebe47
commit cc6891dde8
3 changed files with 12 additions and 1 deletions
+6
View File
@@ -39,6 +39,7 @@ class CommandParser : BasicParser {
{"int", ArgType::integer},
{"str", ArgType::string},
{"sel", ArgType::selector},
{"bool", ArgType::boolean},
{"enum", ArgType::enumvalue},
};
public:
@@ -250,6 +251,11 @@ public:
return selectorCheck(arg, value);
case ArgType::integer:
return typeCheck(arg, dv::value_type::integer, value, "integer");
case ArgType::boolean:
if (!arg->optional) {
throw typeError(arg->name, "boolean", value);
}
return value.isBoolean();
case ArgType::string:
if (!value.isString()) {
return !arg->optional;