"cword" is unset and even is not used in completion for other shells, so it probably shouldn't be here either. If it for some reason should be there add the directive "# shellcheck disable=SC2034" to the line above it.
`compopt -o filenames` is a cheap way to accomplish mostly wanted
behavior. However it is semantically incorrect when we are not actually
completing filenames, and has side effects -- for example adds a
trailing slash to candidates matching present dirs.
bash >= 4.1 can `printf -v` to an array index, use it instead where
available.
* fix Bash completion on macOS
The Homebrew-provided bash-completion is version 1.x,
which doesn't provide _init_completion. We add a standard
shim instead.
* Add entry to CHANGELOG
* Update CHANGELOG.md
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
* review: avoid calling _split_longopt repeatedly
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>