diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-15 12:00:21 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-15 12:01:40 -0400 |
commit | 8becbe77bb78c0fe0641d4eeb592803c7b5737f8 (patch) | |
tree | 7ef319c4733eec2c0a32ff3de72287074475c86d /bin/completion | |
parent | cdf709def63b2d63a664aff1120ab9e0cf3a7048 (diff) | |
download | dconf-8becbe77bb78c0fe0641d4eeb592803c7b5737f8.tar.gz |
Install dconf CLI bash completion in /usr/share
Some short while ago the maintainers of bash-completion came to the
pretty reasonable conclusion that completion files are not configuration
data and therefore should be stored in /usr/share rather than /etc.
The /etc path was kept for backwards compatibility, but we should really
get with the new system.
https://bugzilla.gnome.org/show_bug.cgi?id=678536
Diffstat (limited to 'bin/completion')
-rw-r--r-- | bin/completion/dconf | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bin/completion/dconf b/bin/completion/dconf new file mode 100644 index 0000000..37ab477 --- /dev/null +++ b/bin/completion/dconf @@ -0,0 +1,44 @@ + +# Check for bash +[ -z "$BASH_VERSION" ] && return + +#################################################################################################### + +__dconf() { + local choices + + case "${COMP_CWORD}" in + 1) + choices=$'help \nread \nlist \nwrite \nreset\n update \nlock \nunlock \nwatch \ndump \nload ' + ;; + + 2) + case "${COMP_WORDS[1]}" in + help) + choices=$'help \nread \nlist \nwrite \nreset\n update \nlock \nunlock \nwatch \ndump \nload ' + ;; + list|dump|load) + choices="$(dconf _complete / "${COMP_WORDS[2]}")" + ;; + read|list|write|lock|unlock|watch|reset) + choices="$(dconf _complete '' "${COMP_WORDS[2]}")" + ;; + esac + ;; + + 3) + case "${COMP_WORDS[1]} ${COMP_WORDS[2]}" in + reset\ -f) + choices="$(dconf _complete '' "${COMP_WORDS[3]}")" + ;; + esac + ;; + esac + + local IFS=$'\n' + COMPREPLY=($(compgen -W "${choices}" "${COMP_WORDS[$COMP_CWORD]}")) +} + +#################################################################################################### + +complete -o nospace -F __dconf dconf |