-
Notifications
You must be signed in to change notification settings - Fork 385
Closed
Description
Having only !--no-flag
specified when adding an option or having it as the first name will result in wrong (reversed) config file outputs.
Steps to reproduce:
- Run with
--no-flag
. This results with setting the variableflag=false
(correct), but it outputsno-flag=false
. - Save the output (
no-flag=false
) toconfig.toml
- Run with
--config "path/to/config.toml"
. This results withflag=true
and the output isno-flag=true
.
#include <CLI11/CLI11.hpp>
#include <iostream>
int main()
{
CLI::App app;
bool flag;
app.add_flag("!--no-flag", flag);
app.set_config("--config,--ini");
try {
app.parse(argc, argv);
} catch (const CLI::Error& e) {
return app.exit(e);
}
std::cout << app.config_to_str(false, false) << std::endl;
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels