Commit e074943f authored by Florian Oetke's avatar Florian Oetke
Browse files

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 { ...@@ -131,15 +131,19 @@ namespace mirrage::util {
if(arg_iter == arg_end) { if(arg_iter == arg_end) {
LOG(plog::error) << "Not enough arguments."; LOG(plog::error) << "Not enough arguments.";
return util::nothing; 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>( return util::from_string<typename decltype(type)::type>(
cmd.substr(std::size_t(arg_iter->position()), cmd.substr(std::size_t(curr.position()),
std::size_t(arg_iter->length()))); std::size_t(curr.length())));
} else { // quoted } else { // quoted
auto arg = std::string_view((*arg_iter)[1].first, auto arg = std::string_view(curr[1].first,
std::size_t((*arg_iter)[1].length())); std::size_t(curr[1].length()));
if(!arg.find("\\")) if(!arg.find("\\"))
return util::from_string<typename decltype(type)::type>(arg); return util::from_string<typename decltype(type)::type>(arg);
else { 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