From 219df667c9e2a7a30a5babdb84e2f0bba5b73388 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 11 Apr 2021 17:19:14 +0100 Subject: make my bashcomp actually work --- .bash_completion | 11 +++++++++-- .bash_completion.d/dmount.bashcomp | 7 +++++++ .bash_completion.d/mupdf.bashcomp | 25 +++++++++++++++++++++++++ .bash_completion.d/pd.bashcomp | 2 ++ .bash_completion.d/website.bashcomp | 1 + 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .bash_completion.d/dmount.bashcomp create mode 100644 .bash_completion.d/mupdf.bashcomp create mode 100644 .bash_completion.d/pd.bashcomp create mode 120000 .bash_completion.d/website.bashcomp diff --git a/.bash_completion b/.bash_completion index 4eb8044..0dd54ff 100644 --- a/.bash_completion +++ b/.bash_completion @@ -1,2 +1,9 @@ -_xfunc perl _perldoc -complete -F _perldoc -o bashdefault pm pd +# -*- mode: sh -*- + +bcdir="$HOME/.bash_completion.d" +if [[ -d "$bcdir" && -r "$bcdir" && -x "$bcdir" ]]; then + for i in "$bcdir"/*.bashcomp; do + [[ -f $i && -r $i ]] && . "$i" + done +fi + diff --git a/.bash_completion.d/dmount.bashcomp b/.bash_completion.d/dmount.bashcomp new file mode 100644 index 0000000..adbd251 --- /dev/null +++ b/.bash_completion.d/dmount.bashcomp @@ -0,0 +1,7 @@ +# -*- mode: sh -*- + +_dmount_list() { + COMPREPLY=( $(dmount --list) ) +} + +complete -F _dmount_list dmount diff --git a/.bash_completion.d/mupdf.bashcomp b/.bash_completion.d/mupdf.bashcomp new file mode 100644 index 0000000..dd02b65 --- /dev/null +++ b/.bash_completion.d/mupdf.bashcomp @@ -0,0 +1,25 @@ +# mupdf(1) completion -*- shell-script -*- + +_mupdf() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help*|-h|-p|-r|-W|-H|-S|-U|-x) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir '@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2|.xz|.XZ)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|epub)' +} && +complete -F _mupdf mupdf diff --git a/.bash_completion.d/pd.bashcomp b/.bash_completion.d/pd.bashcomp new file mode 100644 index 0000000..4eb8044 --- /dev/null +++ b/.bash_completion.d/pd.bashcomp @@ -0,0 +1,2 @@ +_xfunc perl _perldoc +complete -F _perldoc -o bashdefault pm pd diff --git a/.bash_completion.d/website.bashcomp b/.bash_completion.d/website.bashcomp new file mode 120000 index 0000000..cd8d05a --- /dev/null +++ b/.bash_completion.d/website.bashcomp @@ -0,0 +1 @@ +/home/dakkar/website/thenautilus/website.bashcomp \ No newline at end of file -- cgit v1.2.3