Currently, the README says to use ArgumentParser::is_used(std::string_view) to check if an argument was used. This returns Argument::m_is_used.
I don't want to repeat a string. That's error-prone and can't be caught by the compiler if anything changes. I'd prefer the following pattern:
argparse::Argument& testArg = program.add_argument("-t", "--test").flag();
program.parse_args(argc, argv);
if ( testArg.is_used() ){
;/* do something */
}
and maybe let operator bool() redirect to that function, too:
Is this intentionally disallowed? Would you be willing to accept a merge request to add this feature?
Currently, the README says to use
ArgumentParser::is_used(std::string_view)to check if an argument was used. This returnsArgument::m_is_used.I don't want to repeat a string. That's error-prone and can't be caught by the compiler if anything changes. I'd prefer the following pattern:
and maybe let
operator bool()redirect to that function, too:Is this intentionally disallowed? Would you be willing to accept a merge request to add this feature?