MCPcopy Create free account
hub / github.com/docopt/docopt.cpp / isOptionSet

Function isOptionSet

docopt.cpp:548–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546}
547
548static bool isOptionSet(PatternList const& options, std::string const& opt1, std::string const& opt2 = "") {
549 return std::any_of(options.begin(), options.end(), [&](std::shared_ptr<Pattern const> const& opt) -> bool {
550 auto const& name = opt->name();
551 if (name==opt1 || (!opt2.empty() && name==opt2)) {
552 return opt->hasValue();
553 }
554 return false;
555 });
556}
557
558static void extras(bool help, bool version, PatternList const& options) {
559 if (help && isOptionSet(options, "-h", "--help")) {

Callers 1

extrasFunction · 0.85

Calls 1

hasValueMethod · 0.45

Tested by

no test coverage detected