1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 12:43:52 +00:00

Run clang-format script

This commit is contained in:
Henry Fredrick Schreiner 2017-12-23 09:47:52 -06:00
parent f16f9e223a
commit b10b9c8291
2 changed files with 16 additions and 15 deletions

View File

@ -809,7 +809,8 @@ class App {
/// Produce a string that could be read in as a config of the current values of the App. Set default_also to include
/// default arguments. Prefix will add a string to the beginning of each option.
std::string config_to_str(bool default_also = false, std::string prefix = "", bool write_description = false) const {
std::string
config_to_str(bool default_also = false, std::string prefix = "", bool write_description = false) const {
std::stringstream out;
for(const Option_p &opt : options_) {
@ -840,10 +841,10 @@ class App {
} else if(opt->count() == 0 && default_also) {
value = "false";
}
if (value.size() != 0) {
if (write_description && opt->has_description()) {
if (out.tellp() != 0) {
if(value.size() != 0) {
if(write_description && opt->has_description()) {
if(out.tellp() != 0) {
out << std::endl;
}
out << "; " << opt->get_description() << std::endl;

View File

@ -576,14 +576,14 @@ TEST_F(TApp, IniOutputNoConfigurable) {
}
TEST_F(TApp, IniOutputShortSingleDescription) {
std::string flag = "some_flag";
std::string description = "Some short description.";
app.add_flag("--" + flag, description);
run();
std::string str = app.config_to_str(true, "", true);
EXPECT_THAT(str, HasSubstr("; " + description + "\n" + flag + "=false\n"));
std::string flag = "some_flag";
std::string description = "Some short description.";
app.add_flag("--" + flag, description);
run();
std::string str = app.config_to_str(true, "", true);
EXPECT_THAT(str, HasSubstr("; " + description + "\n" + flag + "=false\n"));
}
TEST_F(TApp, IniOutputShortDoubleDescription) {
@ -593,9 +593,9 @@ TEST_F(TApp, IniOutputShortDoubleDescription) {
std::string description2 = "Second description.";
app.add_flag("--" + flag1, description1);
app.add_flag("--" + flag2, description2);
run();
std::string str = app.config_to_str(true, "", true);
EXPECT_EQ(str, "; " + description1 + "\n" + flag1 + "=false\n\n; " + description2 + "\n" + flag2 + "=false\n");
}