Commit 4e208b95b7ae488b0d31fcc80228b141792b79b5
1 parent
ad2d1a6b
Add a program function
Fixes 323. Adds a function to retrieve the program name.
Showing
3 changed files
with
13 additions
and
0 deletions
CHANGELOG.md
| ... | ... | @@ -3,6 +3,12 @@ |
| 3 | 3 | This is the changelog for `cxxopts`, a C++11 library for parsing command line |
| 4 | 4 | options. The project adheres to semantic versioning. |
| 5 | 5 | |
| 6 | +## Unreleased | |
| 7 | + | |
| 8 | +### Added | |
| 9 | + | |
| 10 | +* Add a `program()` function to retrieve the program name. | |
| 11 | + | |
| 6 | 12 | ## 3.0 |
| 7 | 13 | |
| 8 | 14 | ### Changed | ... | ... |
include/cxxopts.hpp
test/options.cpp
| ... | ... | @@ -95,6 +95,8 @@ TEST_CASE("Basic options", "[options]") |
| 95 | 95 | CHECK(arguments[3].key() == "av"); |
| 96 | 96 | |
| 97 | 97 | CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::option_has_no_value_exception&); |
| 98 | + | |
| 99 | + CHECK(options.program() == "tester"); | |
| 98 | 100 | } |
| 99 | 101 | |
| 100 | 102 | TEST_CASE("Short options", "[options]") | ... | ... |