1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 13:13:53 +00:00

Removing non-configurable from config_to_str

This commit is contained in:
Henry Fredrick Schreiner 2017-11-30 09:34:45 -05:00
parent 93a16eea61
commit 68207bdcc1
2 changed files with 16 additions and 2 deletions

View File

@ -810,8 +810,8 @@ class App {
std::stringstream out;
for(const Option_p &opt : options_) {
// Only process option with a long-name
if(!opt->lnames_.empty()) {
// Only process option with a long-name and configurable
if(!opt->lnames_.empty() && opt->get_configurable()) {
std::string name = prefix + opt->lnames_[0];
// Non-flags

View File

@ -561,6 +561,20 @@ TEST_F(TApp, IniOutputSimple) {
EXPECT_EQ("simple=3\n", str);
}
TEST_F(TApp, IniOutputNoConfigurable) {
int v1, v2;
app.add_option("--simple", v1);
app.add_option("--noconf", v2)->configurable(false);
args = {"--simple=3", "--noconf=2"};
run();
std::string str = app.config_to_str();
EXPECT_EQ("simple=3\n", str);
}
TEST_F(TApp, IniOutputVector) {
std::vector<int> v;