You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong argument handling when specifying 'ignore_unknown_options' in combination with options #602
I am having trouble with argument handling when specifying the 'ignore_unknown_options' in combination with options.
In this specific case, I need to use the 'ignore_unknown_options' flag in order to pass a unknown amount of arguments AND options to an underlying process. (And prevent click from interpreting words beginning with a dash '-' as options).
At the same time, whenever you have an option specified with a letter, click will still steal this single letter from the argument.
Use -- to turn off subsequent option parsing. All tokens after the -- are treated as arguments.
cli -- -DCMAKE_CXX_FLAGS=-Wreturn-type
The specific behavior reported is a weird ambiguity with how a few different features of the parser. Since short options can be combined, and unknown options were ignored, the short option parsing scans each character in the token to see if it's individually a valid option, and collects all unknown options, recombining them at the end as an extra argument. Since -y is a valid option, and none of the other characters are, -y gets collected and removed from the rest.
Activity
davidism commentedon Feb 27, 2022
Use
--to turn off subsequent option parsing. All tokens after the--are treated as arguments.The specific behavior reported is a weird ambiguity with how a few different features of the parser. Since short options can be combined, and unknown options were ignored, the short option parsing scans each character in the token to see if it's individually a valid option, and collects all unknown options, recombining them at the end as an extra argument. Since
-yis a valid option, and none of the other characters are,-ygets collected and removed from the rest.