Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions gemc/goptions/goptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ GOptions::GOptions(int argc, char* argv[], const GOptions& user_defined_options)
string keyPart = argStr.substr(0, eqPos);
string valuePart = argStr.substr(eqPos + 1);

// Switch with an explicit boolean value: -gui=false / -gui=true. This gives the
// CLI a way to turn a switch off, honoring the documented CLI-over-YAML precedence.
if (switches.find(keyPart) != switches.end()) {
if (valuePart == "true" || valuePart == "1") { switches[keyPart].turnOn(); }
else if (valuePart == "false" || valuePart == "0") { switches[keyPart].turnOff(); }
else {
cerr << "The switch " << keyPart << " accepts only true/false." << endl;
exit(EC__NOOPTIONFOUND);
}
continue;
}

// Strip outer quotes if present (e.g., -gstreamer="[...]")
if (!valuePart.empty() && valuePart.front() == '"' && valuePart.back() == '"') {
valuePart = valuePart.substr(1, valuePart.length() - 2);
Expand Down