JezerM
4 years ago
3 changed files with 47 additions and 1 deletions
@ -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 |
@ -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…
Reference in new issue