Commit Graph

5 Commits

Author SHA1 Message Date
Arthur Williams 6f23aa0d3e bash completion: Allow completions to work without external functions
If bash_completion wasn't installed, _filedir wouldn't be defined which
led to all filename-based completions to error out. Specifically
autocompletion would fail when a filename was expected and when
bash_completion wasn't installed. Now we fall back to `compgen -f` if
_filedir fails. According to _filedir's comments, compgen doesn't
handle files with spaces well, but it is still better to complete most
files than none.
2021-09-05 16:51:38 -07:00
Philip Langdale 6799f8e0e9 bash completion: complete ao/af/vo/vf options
I didn't handle these originally, but it turns out that they can be
handled with the samel logic as Choice options.
2020-02-08 09:50:58 -08:00
Philip Langdale 8676f4616c bash completion: Cache the options list
The bash completion seems to be working decently at this point, so I
feel comfortable caching the options output to improve the performance
of the completion.
2020-02-08 09:50:58 -08:00
Philip Langdale 3259494d9e bash completion: only generate option list when needed
Right now we are generating the fully option list before doing
anything else. That makes filename completion significantly slower
than it was before, for no gain. It's easy to only generate the
option list when it's actually needed.

I also know I could additionally cache the option list across
invocations, but I'm not doing that yet to make testing easier.
2020-01-13 17:12:25 -08:00
Philip Langdale 8b85b40b2f bash completion: add initial implementation of bash completion
While we've had a zsh completion script for a while, we haven't had
one for bash. This one is reasonably comprehensive, although there are
improvements one could imagine for certain options.
2020-01-09 12:07:05 -08:00