-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Description
Hi.
It seems that set_version_flag
behavior changed recently.
Previously, even using required options, when using the version flag application just printed the version as expected and exited.
Now, returns an error and does not print version anymore.
I just tested with today's main branch a41ba814b3202aeb35f6ed36f0fde80402bf85cc
.
Here is a simple reproducer.
#include <CLI/CLI.hpp>
#include <string>
int main(int argc, char*argv[]) {
CLI::App app{"reproducer"};
std::string filename;
auto filename_option= app.add_option("filename", filename, "data file")
->check(CLI::ExistingFile)
->required();
auto version_flag = app.set_version_flag("-v,--version", "0.0.1");
try {
app.parse(argc, argv);
}
catch (const CLI::ParseError& e) {
std::exit(app.exit(e, std::cout, std::cerr));
}
return 0;
}
running it produces
$ ./a.out --version
filename is required
Run with --help for more information.
and adding a useless existing filename gives
$ ./a.out --version a_file
0.0.1
Thanks,
Stéphane.
Metadata
Metadata
Assignees
Labels
No labels