OS X seems to use older bash version which doesn't suport
_init_completion and compopt, so add support for this.
Details
Diff Detail
- Build Status
Buildable 7895 Build 7895: arc lint + arc unit
Event Timeline
clang/utils/bash-autocomplete.sh | ||
---|---|---|
3 | You want to describe it in a comment: _filedir function provided by recent versions of bash-completion package is better than "compgen -f" because the former honors spaces in pathnames while the latter doesn't. So we use compgen only when _filedir is not provided. | |
17–18 | It's not clear what this code does. Can you explain? |
clang/utils/bash-autocomplete.sh | ||
---|---|---|
8–9 | If this works, you can probably make it shorter _filedir 2> /dev/null || COMPREPLY=... |
_get_comp_words_by_ref still depends on older bash-completion package, so delete this and set cword and cur manualy.
LGTM. Confirmed that it works as expected on my Mac which doesn't have the bash-autocomplete package.
clang/utils/bash-autocomplete.sh | ||
---|---|---|
19 | I think you want to quote $COMP_WORD with "" so that it works even if $COMP_WORD contains space characters. |
LGTM, everything still works in the latest bash on Linux.
Also thanks for the reviews Rui!
Is the output of compgen -f the same as _filedir? If so, can you always use compgen -f?