mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-27 12:06:00 +01:00
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.
This commit is contained in:
parent
2713de2f6c
commit
0b9571e4c1
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
_zathura() {
|
_zathura() {
|
||||||
_init_completion || return
|
_init_completion 2>/dev/null || true
|
||||||
|
|
||||||
local EXTS=""
|
local EXTS=""
|
||||||
for PLUGIN in @PLUGINDIR@/lib*.so; do
|
for PLUGIN in @PLUGINDIR@/lib*.so; do
|
||||||
|
@ -22,6 +23,6 @@ _zathura() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
_filedir "${EXTS#|}"
|
_filedir "${EXTS#|}" 2>/dev/null || COMPREPLY=($(shopt -s extglob; compgen -f -X "!*.@($EXTS)"))
|
||||||
}
|
}
|
||||||
complete -F _zathura zathura
|
complete -F _zathura zathura
|
||||||
|
|
Loading…
Reference in a new issue