diff options
author | David Zeuthen <zeuthen@gmail.com> | 2012-09-28 13:58:04 -0400 |
---|---|---|
committer | David Zeuthen <zeuthen@gmail.com> | 2012-09-28 13:58:04 -0400 |
commit | 99161b5cca305b7853680cfab54a3c633873ef5d (patch) | |
tree | bf1c96990c89abf269987cf4ca0049b2762f6bf5 /data | |
parent | 029ffb73a176f1860d6edaf47eb89ea86a37549e (diff) |
Move bash completion script into /usr/share/bash-completion/completions
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
Diffstat (limited to 'data')
-rw-r--r-- | data/Makefile.am | 6 | ||||
-rw-r--r-- | data/completions/udisksctl | 29 |
2 files changed, 35 insertions, 0 deletions
diff --git a/data/Makefile.am b/data/Makefile.am index 3f31023..0921698 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -32,6 +32,11 @@ polkitdir = $(datadir)/polkit-1/actions polkit_in_files = org.freedesktop.udisks2.policy.in polkit_DATA = $(polkit_in_files:.policy.in=.policy) +completionsdir = $(datadir)/bash-completion/completions +completions_DATA = \ + completions/udisksctl \ + $(NULL) + @INTLTOOL_POLICY_RULE@ EXTRA_DIST = \ @@ -41,6 +46,7 @@ EXTRA_DIST = \ $(dbusservice_in_files) \ $(dbusconf_in_files) \ $(polkit_in_files) \ + $(completions_DATA) \ $(NULL) clean-local : diff --git a/data/completions/udisksctl b/data/completions/udisksctl new file mode 100644 index 0000000..39d5ca9 --- /dev/null +++ b/data/completions/udisksctl @@ -0,0 +1,29 @@ +# udisksctl(1) completion -*- shell-script -*- + +_udisksctl() { + local IFS=$'\n' + local cur=`_get_cword :` + + local suggestions=$(udisksctl complete "${COMP_LINE}" ${COMP_POINT}) + if [ "$suggestions" = "@FILES@" ] ; then + _filedir + else + COMPREPLY=($(compgen -W "$suggestions" -- "$cur")) + fi + + # Remove colon-word prefix from COMPREPLY items + case "$cur" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) + local colon_word=${cur%${cur##*:}} + local i=${#COMPREPLY[*]} + while [ $((--i)) -ge 0 ]; do + COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} + done + ;; + esac + ;; + esac +} && +complete -o nospace -F _udisksctl udisksctl |