Commit Graph

10 Commits

Author SHA1 Message Date
Gabriele Mazzotta 27359c3ff1 bash-completion: parse the mpv options lazily
Parse and cache the options lazily not to impact the shell
startup time.
2024-01-21 10:44:42 -08:00
Philip Langdale a1c8bb2257 {zsh,bash}-completion: use config when autocompleting profiles
We were over-enthusiastic when introducing --no-config into the
autocompletions. When autocompleting profiles, you actually need the
config, because that's where the profiles come from.

zsh is untested - I don't use it.
2023-09-03 13:44:31 +02:00
Niklas Haas 1bf6abc62d {zsh,bash}-completion: add missing --no-config flags
Seemingly forgotten, even though the intent was to add them.

Fixes: 15252e13d5
2023-09-02 20:32:56 +02:00
sfan5 15252e13d5 {zsh,bash}-completion: run mpv with --no-config
Reading the config when we're just interested in the option list
(not sure why mpv does that anyway) only has the potential to mess
this process up when it prints errors or the user has funny options
like msg-level or log-file set, so avoid doing so.
2023-07-19 13:01:08 +02:00
sfan5 5f664e2a1d bash-completion: do not complete removed options 2023-07-19 13:01:08 +02:00
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