1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 20:23:55 +00:00

Adding =false when printing config with defaults

This commit is contained in:
Henry Schreiner 2017-03-30 15:49:40 -04:00
parent ea033e5247
commit ae5bf0ce62
2 changed files with 8 additions and 0 deletions

View File

@ -573,7 +573,12 @@ public:
// Flag, multiple passed
} else if(opt->count() > 1) {
out << name << "=" << opt->count() << std::endl;
// Flag, not present
} else if(opt->count() == 0 && default_also) {
out << name << "=false" << std::endl;
}
}
}
for(const App_p &subcom : subcommands_)

View File

@ -520,6 +520,9 @@ TEST_F(TApp, IniOutputFlag) {
EXPECT_THAT(str, Not(HasSubstr("nothing")));
EXPECT_THAT(str, HasSubstr("onething=true"));
EXPECT_THAT(str, HasSubstr("something=2"));
std::string str = app.config_to_str(true);
EXPECT_THAT(str, HasSubstr("nothing"));
}
TEST_F(TApp, IniOutputSet) {