Commit e074943f authored by Florian Oetke's avatar Florian Oetke

fixed argument parsing in utils/console_command

parent fe73cebb
Pipeline #2854 passed with stage
in 13 minutes and 54 seconds
......@@ -131,15 +131,19 @@ namespace mirrage::util {
if(arg_iter == arg_end) {
LOG(plog::error) << "Not enough arguments.";
return util::nothing;
}
auto curr = *arg_iter;
arg_iter++;
} else if((*arg_iter)[1].length() == 0) {
if(curr[1].length() == 0) {
return util::from_string<typename decltype(type)::type>(
cmd.substr(std::size_t(arg_iter->position()),
std::size_t(arg_iter->length())));
cmd.substr(std::size_t(curr.position()),
std::size_t(curr.length())));
} else { // quoted
auto arg = std::string_view((*arg_iter)[1].first,
std::size_t((*arg_iter)[1].length()));
auto arg = std::string_view(curr[1].first,
std::size_t(curr[1].length()));
if(!arg.find("\\"))
return util::from_string<typename decltype(type)::type>(arg);
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment