8000 A problem with `exists` function · Issue #6 · hbristow/argparse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
A problem with exists function #6
Open
@ahmad-siavashi

Description

@ahmad-siavashi

index_ variable is a map that holds the arguments that are added using addArgument.
The exists function is currently written as follows
bool exists(const String& name) const { return index_.count(delimit(name)) > 0; }

so a code like the one below will always enter the if's body, even if the clean argument has not been sent to the program,

parser.addArgument("-c", "--clean");
// parsing passed arguments
parser.parse(size_t(__argc), const_cast<const char **>(__argv));
if (parser.exists("clean")) { 
   // ...
}

This is inconsistent with the definition given for the exists function

exists() check if an argument has been found

Thank you for your efforts,
Sincerely,
Ahmad

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0