mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +00:00
* ArgumentParser takes a second argument - the program version (std::string) * Using --version or -v will print the program version and exit
13 lines
368 B
C++
13 lines
368 B
C++
#include <doctest.hpp>
|
|
#include <argparse/argparse.hpp>
|
|
|
|
using doctest::test_suite;
|
|
|
|
TEST_CASE("Users can print version and exit" * test_suite("version")) {
|
|
argparse::ArgumentParser program("cli-test", "1.9.0");
|
|
program.add_argument("-d", "--dir")
|
|
.required();
|
|
program.parse_args( { "test", "--version" });
|
|
REQUIRE(program.get("--version") == "1.9.0");
|
|
}
|