-
Notifications
You must be signed in to change notification settings - Fork 60
Cmdliner completions break if CMDLINER_LEGACY_PREFIXES is true at --__complete time #262
Description
For example, this actually works fine:
$ CMDLINER_LEGACY_PREFIXES=1 stanc -<TAB>
-? --debug-generate-inits --debug-transformed-mir --info --print-cppBut this, which would usually be equivalent, does not:
$ export CMDLINER_LEGACY_PREFIXES=1
$ stanc -<TAB>
Usage: %%NAME%% [--help] [OPTION]… [MODEL_FILE]
stanc: option - ambiguous and could be one of --O0, --O1, --Oexperimental,
In some ways this seems silly -- it's listing all the valid completions in the error message!
To directly see the issue, the same error arises if you
$ CMDLINER_LEGACY_PREFIXES=1 stanc --__complete --__complete=-
(it works fine if there are prefixes used before the --_complete= item, or if it's unambiguous, like in stanc this does offer valid completions even though the argument names are auto-format and canonicalize: $ CMDLINER_LEGACY_PREFIXES=1 stanc --__complete --__complete=--canon=<TAB>)
In particular, this means that the patch you suggest here and here breaks completion for more or less all options, as - will always be highly ambiguous. Some sort of special-casing seems worthwhile?