# bash completion for fbgs(1) -*- shell-script -*- proc _fbgs { local cur prev words cword _init_completion || return match $prev { with -f|--font local IFS=$'\n' setglobal COMPREPLY = ''( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) return with -m|--mode setglobal COMPREPLY = ''( $( compgen -W '$( sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return with -d|--device setglobal COMPREPLY = ''( $( compgen -f -d -- "${cur:-/dev/}" ) ) return with -fp|--firstpage|-lp|--lastpage|-r|--resolution|-s|--scroll|-t|\ --timeout # expect integer value setglobal COMPREPLY = ''( $( compgen -W '{0..9}' ) ) compopt -o nospace return with -T|--vt|-p|--password|-g|--gamma # argument required but no completions available return } if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '--bell --help --password -fp --firstpage -lp --lastpage --color -l -xl -xxl --resolution --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose --{,no}random --vt --scroll --timeout --{,no}once --gamma --font --device --mode' -- "$cur" ) ) [[ $COMPREPLY ]] && return } _filedir '?(e)ps|pdf' } && complete -F _fbgs fbgs # ex: ts=4 sw=4 et filetype=sh