Skip to content

Commit

Permalink
Only fix quote strings, not vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Jan 19, 2019
1 parent e09a1fc commit e5957b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion include/CLI/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ ConfigINI::to_config(const App *app, bool default_also, bool write_description,
}
out << "; " << detail::fix_newlines("; ", opt->get_description()) << std::endl;
}
out << name << "=" << detail::add_quotes_if_needed(value) << std::endl;

// Don't try to quote anything that is not size 1
if(opt->get_items_expected() != 1)
out << name << "=" << value << std::endl;
else
out << name << "=" << detail::add_quotes_if_needed(value) << std::endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/IniTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ TEST_F(TApp, IniOutputVector) {
run();

std::string str = app.config_to_str();
EXPECT_EQ("vector=\"1 2 3\"\n", str);
EXPECT_EQ("vector=1 2 3\n", str);
}

TEST_F(TApp, IniOutputFlag) {
Expand Down

0 comments on commit e5957b6

Please sign in to comment.