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:
parent
93a16eea61
commit
68207bdcc1
@ -810,8 +810,8 @@ class App {
|
|||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
for(const Option_p &opt : options_) {
|
for(const Option_p &opt : options_) {
|
||||||
|
|
||||||
// Only process option with a long-name
|
// Only process option with a long-name and configurable
|
||||||
if(!opt->lnames_.empty()) {
|
if(!opt->lnames_.empty() && opt->get_configurable()) {
|
||||||
std::string name = prefix + opt->lnames_[0];
|
std::string name = prefix + opt->lnames_[0];
|
||||||
|
|
||||||
// Non-flags
|
// Non-flags
|
||||||
|
@ -561,6 +561,20 @@ TEST_F(TApp, IniOutputSimple) {
|
|||||||
EXPECT_EQ("simple=3\n", str);
|
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) {
|
TEST_F(TApp, IniOutputVector) {
|
||||||
|
|
||||||
std::vector<int> v;
|
std::vector<int> v;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user