Include bash-completion

This commit is contained in:
Sebastian Ramacher 2018-05-22 09:21:14 +02:00
parent 752d408c4b
commit 11da8e7c8e
2 changed files with 37 additions and 0 deletions

27
data/bash-completion.in Normal file
View File

@ -0,0 +1,27 @@
_zathura() {
_init_completion || return
local EXTS=""
for PLUGIN in @PLUGINDIR@/lib*.so; do
case ${PLUGIN##*/} in
libpdf-poppler.so)
EXTS="$EXTS|pdf"
;;
libpdf-mupdf.so)
EXTS="$EXTS|pdf|epub|oxps"
;;
libps.so)
EXTS="$EXTS|ps|eps|epsi|epsf"
;;
libdjvu.so)
EXTS="$EXTS|djvu|djv"
;;
libcb.so)
EXTS="$EXTS|cb7|cbr|cbz|cbt|rar|zip|7z|tar"
;;
esac
done
_filedir "${EXTS#|}"
}
complete -F _zathura zathura

View File

@ -44,3 +44,13 @@ if appstream_util.found()
args: ['validate-relax', appdata.full_path()]
)
endif
conf_data = configuration_data()
conf_data.set('PLUGINDIR', join_paths(prefix, plugindir))
bash_completion = configure_file(
input: 'bash-completion.in',
output: 'zathura',
configuration: conf_data
)
install_data(bash_completion, install_dir: join_paths(datadir, 'bash-completion', 'completions'))