Add a program function
Fixes 323. Adds a function to retrieve the program name.
This commit is contained in:
parent
ad2d1a6b5f
commit
4e208b95b7
@ -3,6 +3,12 @@
|
|||||||
This is the changelog for `cxxopts`, a C++11 library for parsing command line
|
This is the changelog for `cxxopts`, a C++11 library for parsing command line
|
||||||
options. The project adheres to semantic versioning.
|
options. The project adheres to semantic versioning.
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Add a `program()` function to retrieve the program name.
|
||||||
|
|
||||||
## 3.0
|
## 3.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@ -1825,6 +1825,11 @@ namespace cxxopts
|
|||||||
const HelpGroupDetails&
|
const HelpGroupDetails&
|
||||||
group_help(const std::string& group) const;
|
group_help(const std::string& group) const;
|
||||||
|
|
||||||
|
const std::string& program() const
|
||||||
|
{
|
||||||
|
return m_program;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -95,6 +95,8 @@ TEST_CASE("Basic options", "[options]")
|
|||||||
CHECK(arguments[3].key() == "av");
|
CHECK(arguments[3].key() == "av");
|
||||||
|
|
||||||
CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::option_has_no_value_exception&);
|
CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::option_has_no_value_exception&);
|
||||||
|
|
||||||
|
CHECK(options.program() == "tester");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Short options", "[options]")
|
TEST_CASE("Short options", "[options]")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user