-
Notifications
You must be signed in to change notification settings - Fork 384
Description
Context
Hi, I'm using CLI11 in my project, and it's a very nice alternative to the Boost parser!
This is my variable parser:
CLI::App _cmdLineOptionsCLI;
I'm using the function _cmdLineOptionsCLI.parse(argc, argv)
by giving a vector of options.
It may be that the options in argv are not in the options defined by add_options
, so I added a
cmdLineOptionsCLI.allow_extras(true);
The problem
When I have for example "--nbVar ; 5"
in my argv and are not defined in add_options, "--nbVar"
is considered by the classifier like a Classifier::LONG
and "5" is considered like a Classifier::NONE
, so with the first arguments, we pop correctly the option, but with 5 we reach this line of code
posOpt = opt.get();
in CLI11_INLINE bool App::_parse_positional
By reaching this line, it fills a variable containing options defined by add_options
, which is incorrect.
A solution proposed
If we add some lines to pop_back the argument and the value if the classifier is SHORT, LONG, WINDOWS_STYLE
, it solves the problem. We suppose that if we have extra args like this "--nbVar 5", we can remove two elements instead of only one.
Is it possible to add these lines of code like this?
if(current_type == detail::Classifier::LONG || current_type == detail::Classifier::WINDOWS_STYLE ||
current_type == detail::Classifier::SHORT ) {
args.pop_back();
}
App_inl.hpp line 2005.
Best regards,
Najib