diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index e37d53f1..41b78dee 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -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_) diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index 934d727c..8fb8e96a 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -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) {