You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
906 B

#!/usr/bin/env bash
# bash completion for web-greeter
_web-greeter() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local last="${COMP_WORDS[COMP_CWORD - 1]}"
local xpat='!*.jpg'
local options='--debug -d --normal -n --mode --list --theme --help -h --version -v --api-version'
for word in "${COMP_WORDS[@]}"; do
case "${word}" in
--debug | --normal | -d | -n | --mode)
options=$(echo "${options}" | sed 's/--normal\|-n//g')
options=$(echo "${options}" | sed 's/--debug\|-d//g')
options=$(echo "${options}" | sed 's/--mode//g')
;;
esac
done
case "${last}" in
--theme)
_filedir
options=$(ls -1d /usr/share/web-greeter/themes/*/ | cut -c 1- |
rev | cut -c 2- | rev | sort | sed 's/\/usr\/share\/web-greeter\/themes\///')
;;
--mode)
options="debug normal"
;;
esac
COMPREPLY+=( $(compgen -W "${options}" -- "${cur}") )
}
complete -F _web-greeter web-greeter