mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 00:45:32 +00:00
32 lines
1.2 KiB
Text
32 lines
1.2 KiB
Text
#/usr/bin/env bash
|
|
|
|
_km-package-get_completions()
|
|
{
|
|
local cur prev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
opts="-h --help -v --verbose -vv --veryverbose --version"
|
|
|
|
if [[ ${cur} == -* ]] ; then
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
fi
|
|
|
|
words=""
|
|
if [[ ! -e ~/.cache/keyman/kmpdirlist ]] ; then
|
|
if [[ -e ./km-package-install ]]; then
|
|
python3 -c "from imp import load_source;load_source('km_package_install', './km-package-install');from km_package_install import list_keyboards;list_keyboards()"
|
|
else
|
|
python3 -c "from imp import load_source;load_source('km_package_install', '/usr/bin/km-package-install');from km_package_install import list_keyboards;list_keyboards()"
|
|
fi
|
|
fi
|
|
|
|
if [[ -r ~/.cache/keyman/kmpdirlist ]] ; then
|
|
for file in `cat ~/.cache/keyman/kmpdirlist`; do words="${words} ${file}"; done
|
|
COMPREPLY=($(compgen -W "${words}" -- ${cur}))
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
complete -F _km-package-get_completions km-package-get
|