Browse Source

Added tab completion

sisyphus
JezerM 4 years ago
parent
commit
0024de51d1
  1. 6
      build/utils.sh
  2. 20
      dist/web-greeter-bash
  3. 22
      dist/web-greeter-zsh

6
build/utils.sh

@ -61,7 +61,7 @@ init_build_dir() {
prepare_install() { prepare_install() {
cd "${BUILD_DIR}" cd "${BUILD_DIR}"
mkdir -p \ mkdir -p \
"${INSTALL_ROOT}${PREFIX}"/share/{man/man1,metainfo,web-greeter,xgreeters} \ "${INSTALL_ROOT}${PREFIX}"/share/{man/man1,metainfo,web-greeter,xgreeters,zsh/vendor-completions,bash-completion/completions} \
"${INSTALL_ROOT}"/etc/{lightdm,xdg/lightdm/lightdm.conf.d} "${INSTALL_ROOT}"/etc/{lightdm,xdg/lightdm/lightdm.conf.d}
# Themes # Themes
@ -72,6 +72,10 @@ prepare_install() {
# Man Page # Man Page
cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}${PREFIX}/share/man/man1" cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}${PREFIX}/share/man/man1"
# Command line completions
cp "${BUILD_DIR}/dist/${PKGNAME}-bash" "${INSTALL_ROOT}${PREFIX}/share/bash-completion/completions/${PKGNAME}"
cp "${BUILD_DIR}/dist/${PKGNAME}-zsh" "${INSTALL_ROOT}${PREFIX}/share/zsh/vendor-completions/_${PKGNAME}"
# Greeter Config # Greeter Config
cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm" cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm"

20
dist/web-greeter-bash vendored

@ -0,0 +1,20 @@
#!/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 --normal --list --theme --help -h --version -v'
case "${last}" in
--theme)
options=$(ls -1d /usr/share/web-greeter/themes/*/ | cut -c 1- |
rev | cut -c 2- | rev | sort | sed 's/\/usr\/share\/web-greeter\/themes\///')
;;
esac
COMPREPLY=( $(compgen -W "${options}" -- "${cur}") )
}
complete -F _web-greeter web-greeter

22
dist/web-greeter-zsh vendored

@ -0,0 +1,22 @@
#compdef web-greeter
_webgreeter() {
integer ret=1
local -a args
local themes=$(ls -1d /usr/share/web-greeter/themes/*/ | cut -c 1- |
rev | cut -c 2- | rev | sort | sed 's/\/usr\/share\/web-greeter\/themes\///')
args+=(
'--debug[Runs the greeter in debug mode]'
'--normal[Runs in non-debug mode]'
'--list[Lists available themes]'
"--theme[Sets the theme to use]:theme:(${themes})"
'--help[Show help]'
'-h[Show help]'
'--version[Print program version]'
'-v[Print program version]'
)
_arguments $args[@] && ret=0
return ret
}
_webgreeter
Loading…
Cancel
Save