Skip to content

Commit bec0bf9

Browse files
Disallowing repeated specifying the same option even if bool on the command line
1 parent 630359d commit bec0bf9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

OptionParser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ Option::parse(vector<string> &command_line) {
230230
if (!command_line.empty()) {
231231
for (size_t i = 0; i < command_line.size();)
232232
if (option_match(command_line[i])) {
233-
if (specified && arg_type != SMITHLAB_ARG_BOOL)
234-
throw runtime_error("duplicate assignment to option: " + long_name);
233+
if (specified)
234+
throw runtime_error("duplicate use of option: " + long_name);
235235

236236
if (i < command_line.size() - 1) {
237237
format_option(command_line[i + 1]);
@@ -445,8 +445,8 @@ OptionParser::parse(const int argc, const char **argv,
445445
}
446446

447447
void
448-
OptionParser::parse(const int argc, const char **argv, vector<string> &arguments,
449-
string config_filename) {
448+
OptionParser::parse(const int argc, const char **argv,
449+
vector<string> &arguments, string config_filename) {
450450
// The "2" below corresponds to the "about" and "help" options
451451
assert(options.size() >= 2);
452452

0 commit comments

Comments
 (0)