mirror of
https://github.com/CLIUtils/CLI11.git
synced 2026-01-19 04:52:08 +00:00
Help priority adjustment (#1106)
Move the help generation priority higher so it triggers before config file processing. Fixes #1099 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2097,6 +2097,34 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithEquals", "[con
|
||||
CHECK(app.got_subcommand(subcom));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableHelp", "[config]") {
|
||||
|
||||
TempFile tmpini{"TestIniTmp.ini"};
|
||||
|
||||
app.set_config("--config", tmpini);
|
||||
|
||||
{
|
||||
std::ofstream out{tmpini};
|
||||
out << "[default]" << '\n';
|
||||
out << "val=1" << '\n';
|
||||
out << "[subcom]" << '\n';
|
||||
out << "val=2" << '\n';
|
||||
}
|
||||
|
||||
int one{0}, two{0};
|
||||
app.add_option("--val", one);
|
||||
app.add_option("--helptest", two);
|
||||
auto *subcom = app.add_subcommand("subcom");
|
||||
subcom->configurable();
|
||||
subcom->add_option("--val", two);
|
||||
|
||||
args = {"--help"};
|
||||
CHECK_THROWS_AS(run(), CLI::CallForHelp);
|
||||
|
||||
auto helpres = app.help();
|
||||
CHECK_THAT(helpres, Contains("--helptest"));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithComment", "[config]") {
|
||||
|
||||
TempFile tmpini{"TestIniTmp.ini"};
|
||||
|
||||
@@ -301,7 +301,7 @@ TEST_CASE("StringTools: binaryEscapeConversion2", "[helpers]") {
|
||||
CHECK(rstring == testString);
|
||||
}
|
||||
|
||||
TEST_CASE("StringTools: binaryEscapseConversion_withX", "[helpers]") {
|
||||
TEST_CASE("StringTools: binaryEscapeConversion_withX", "[helpers]") {
|
||||
std::string testString("hippy\\x35mm\\XF3_helpX26fox19");
|
||||
testString.push_back(0);
|
||||
testString.push_back(0);
|
||||
@@ -317,7 +317,7 @@ TEST_CASE("StringTools: binaryEscapseConversion_withX", "[helpers]") {
|
||||
CHECK(rstring == testString);
|
||||
}
|
||||
|
||||
TEST_CASE("StringTools: binaryEscapseConversion_withBrackets", "[helpers]") {
|
||||
TEST_CASE("StringTools: binaryEscapeConversion_withBrackets", "[helpers]") {
|
||||
|
||||
std::string vstr = R"raw('B"([\xb0\x0a\xb0/\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0])"')raw";
|
||||
std::string testString("[");
|
||||
|
||||
Reference in New Issue
Block a user