The following argument was not expected
but the help message show one positional argument
#1134
-
I have the following code to init this library ProgramOptions parseCli(const int argc, char *argv[]) {
ProgramOptions options;
CLI::App app{"Sublime Text/Merge Patcher"};
app.name(std::filesystem::path(argv[0]).filename().string());
app.get_formatter()->column_width(40);
// FIXME for some reason passing a file is not working at all
app.add_option("sublime_binary", options.binary_path, "Path to Sublime Text/Merge binary")->check(CLI::ExistingFile)->type_size(0);
app.add_flag("--scan-fs,-s", options.scan_fs, "Scan filesystem for Sublime binaries");
app.add_option("--log-level,-l", options.log_level, "Log level (trace, debug, info, warn, error, critical)")
->check(CLI::IsMember({"trace", "debug", "info", "warn", "error", "critical"}))
->type_size(0);
app.add_flag("!--no-backup,!-b", options.backup, "Disable backup creation");
try {
app.parse(argc, argv);
} catch (const CLI::CallForHelp &) {
std::cout << app.help() << std::endl;
std::exit(EXIT_SUCCESS);
} catch (const CLI::ParseError &e) {
app.exit(e);
throw;
}
return options;
} The help message is the following:
And when I call it like this I get the error:
I am rather confused as to why this seems to be refusing my positional argument, maybe I am missing something obvious. |
Beta Was this translation helpful? Give feedback.
Answered by
phlptp
Mar 4, 2025
Replies: 1 comment 4 replies
-
Why do you have |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
Big-Iron-Cheems
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why do you have
->type_size(0)
on the binary path option?