mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 08:55:34 +00:00
36 lines
1 KiB
Text
36 lines
1 KiB
Text
#/usr/bin/env bash
|
|
|
|
_km-package-uninstall_completions()
|
|
{
|
|
local cur prev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
opts="-h --help -s --shared -v --verbose -vv --veryverbose --version"
|
|
|
|
if [[ ${cur} == -* ]] ; then
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
fi
|
|
|
|
if [[ "${#COMP_WORDS[@]}" != "2" ]]; then
|
|
if [[ ${prev} != -* ]]; then
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
words=""
|
|
shared=""
|
|
case "${prev}" in
|
|
"-s"|"--shared")
|
|
for file in $(ls -1 /usr/local/share/keyman); do kbid="`basename ${file}`"; shared="${shared} ${kbid}"; done
|
|
COMPREPLY=($(compgen -W "${shared}" -- ${cur}))
|
|
;;
|
|
*)
|
|
for file in $(ls -1 ${XDG_DATA_HOME:-~/.local/share}/keyman); do kbid="`basename ${file}`"; words="${words} ${kbid}"; done
|
|
COMPREPLY=($(compgen -W "${words}" -- ${cur}))
|
|
;;
|
|
esac
|
|
}
|
|
|
|
complete -F _km-package-uninstall_completions km-package-uninstall
|