diff --git a/src/command_manager.cc b/src/command_manager.cc index d5307032..fa970d74 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -421,7 +421,7 @@ void CommandManager::execute_single_command(CommandParameters params, if (params.empty()) return; - ConstArrayView param_view(params.begin()+1, params.end()); + ParameterList param_view(params.begin()+1, params.end()); auto command_it = find_command(context, params[0]); if (command_it == m_commands.end()) throw command_not_found(params[0]); diff --git a/src/parameters_parser.cc b/src/parameters_parser.cc index 1633aa6b..697f1407 100644 --- a/src/parameters_parser.cc +++ b/src/parameters_parser.cc @@ -23,7 +23,7 @@ ParametersParser::ParametersParser(ParameterList params, { if (not only_pos and params[i] == "--") only_pos = true; - else if (not only_pos and params[i][0_byte] == '-') + else if (not only_pos and params[i].length() > 0 and params[i][0_byte] == '-') { auto it = m_desc.switches.find(params[i].substr(1_byte)); if (it == m_desc.switches.end()) @@ -36,7 +36,7 @@ ParametersParser::ParametersParser(ParameterList params, throw missing_option_value(it->key); } } - else + else // positional { if (desc.flags & ParameterDesc::Flags::SwitchesOnlyAtStart) only_pos = true;