Commit Graph

4 Commits

Author SHA1 Message Date
Pranav Srinivas Kumar
6c7da857b6 Added table of contents to README and clang formatted code 2022-09-20 20:27:24 -07:00
Sean Robinson
f0d68de134 Confirm arguments are parsed before allowing ArgumentParser::get
If the developer forgot to call ArgumentParser::parse_args<>, attempts to
use ::get, ::present, etc., would raise "No value provided...".  With this
change, the error better describes what went wrong.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:55:03 -07:00
Sean Robinson
1c2fd8726d Add argument name in exception thrown by Argument::get
As the user did not include the argument, the longest name for the unused
argument is in the last position of mNames.

This is an API change that may affect programs trying to match the
specific "No value provided" message.  The new error message appends the
argument that caused the error.

A solution which works with both versions is to look for "No value
provided" at the beginning of the error message.

- if (err.what() == "No value provided")
+ if (std:string(err.what()).rfind("No value provided", 0) == 0)

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:51:10 -07:00
Sean Robinson
97993666ab Add tests for ArgumentParser::get
These test the API shown in README.md, rather than the Argument::get
function that does most of the work.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:46:22 -07:00