Skip to content
Snippets Groups Projects
Commit 062ca17d authored by Oliver Heidmann's avatar Oliver Heidmann Committed by Uwe Schulzweida
Browse files

simplfied check for missing argument for options

parent a4613421
No related branches found
No related tags found
2 merge requests!326convert_to_number not called string_to_number, fixed usage of .fail enabling...,!322Fixing and cleaning up handling of operator argument sourrounding the use of scientific notations
......@@ -112,17 +112,7 @@ CLIOptions::parse(std::vector<std::string> p_argv)
bool out_of_bounds = i >= p_argv.size();
auto is_new_option = [&]() {
/*
* extracted into labmda for a balance of readability and preventing the seqfault that is caused
* by checking for this when we are out of bounds. By delaying execution we prevent the seqfault
*/
bool all_numbers = !tokenize_comma_seperated_number_list<double>(p_argv[i]).first;
bool has_minus_in_first_pos = (p_argv[i][0] == '-');
return has_minus_in_first_pos && all_numbers;
};
if (out_of_bounds || is_new_option())
if (out_of_bounds || optionMap.find(p_argv[i]) != optionMap.end())
{
if (argument.default_value.size() > 0) { argument.value = argument.default_value; }
else if (!argument.is_optional)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment