#pragma once #include #include TEST_CASE("Users can use defaul value inside actions", "[actions]") { argparse::ArgumentParser program("test"); program.add_argument("input") .default_value("bar") .action([=](const std::string& value) { static const std::vector choices = { "foo", "bar", "baz" }; if (std::find(choices.begin(), choices.end(), value) != choices.end()) { return value; } return std::string{ "bar" }; }); program.parse_args({ "test", "fez" }); auto arguments = program.get_arguments(); REQUIRE(arguments.size() == 1); REQUIRE(program.get("input") == "bar"); }