Util: Add invalid argument type error message to ArgParser
This commit is contained in:
@@ -51,6 +51,9 @@ void ArgParser::printOptionError(const char* name, Error error, bool longName)
|
|||||||
printf("%s: option requires an argument -- '%s'\n", m_name, name);
|
printf("%s: option requires an argument -- '%s'\n", m_name, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (error == Error::InvalidArgumentType) {
|
||||||
|
printf("%s: invalid argument type '%s'\n", m_name, name);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Print command usage, if it's enabled.
|
// TODO: Print command usage, if it's enabled.
|
||||||
}
|
}
|
||||||
@@ -217,6 +220,9 @@ bool ArgParser::parseArgument(std::string_view argument)
|
|||||||
m_argumentIndex++;
|
m_argumentIndex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
printOptionError(argument.data(), Error::InvalidArgumentType);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
ExtraOperand, // For arguments
|
ExtraOperand, // For arguments
|
||||||
DoesntAllowArgument,
|
DoesntAllowArgument,
|
||||||
RequiresArgument,
|
RequiresArgument,
|
||||||
|
InvalidArgumentType,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Option {
|
struct Option {
|
||||||
|
|||||||
Reference in New Issue
Block a user