2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for fbi(1) -*- shell-script -*-
|
2011-10-12 01:50:31 +04:00
|
|
|
|
|
|
|
_fbi()
|
|
|
|
{
|
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
|
|
|
|
|
|
|
case "$prev" in
|
|
|
|
-l|--list)
|
|
|
|
_filedir
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
-r|--resolution)
|
2011-11-20 23:42:20 +03:00
|
|
|
COMPREPLY+=( $( compgen -W '{1..5}' ) )
|
2011-10-12 01:50:31 +04:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
-f|--font)
|
|
|
|
local IFS=$'\n'
|
2011-11-20 23:42:20 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( fc-list 2> /dev/null )' -- "$cur" ) )
|
2011-10-12 01:50:31 +04:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
-m|--mode)
|
2011-11-20 23:42:20 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( sed \
|
2011-10-12 01:50:31 +04:00
|
|
|
-n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \
|
2011-11-20 23:42:20 +03:00
|
|
|
/etc/fb.modes 2> /dev/null )' -- "$cur" ) )
|
2011-10-12 01:50:31 +04:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
-d|--device)
|
2011-11-20 23:42:20 +03:00
|
|
|
COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
|
2011-10-12 01:50:31 +04:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
--cachemem|--blend|-T|--vt|-s|--scroll|-t|--timeout|-g|--gamma)
|
|
|
|
# argument required but no completions available
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-11-20 23:42:20 +03:00
|
|
|
COMPREPLY=( $( compgen -W '--help --version --store --list --text
|
2011-11-20 17:00:03 +03:00
|
|
|
--autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth
|
|
|
|
--{,no}verbose --{,no}random --{,no}comments --{,no}edit
|
|
|
|
--{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend
|
|
|
|
--vt --scroll --timeout --{,no}once --resolution --gamma --font
|
2011-11-20 23:42:20 +03:00
|
|
|
--device --mode' -- "$cur" ) )
|
2011-10-12 01:50:31 +04:00
|
|
|
[[ $COMPREPLY ]] && return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# FIXME: It is hard to determine correct supported extensions.
|
|
|
|
# fbi can handle any format that imagemagick can plus some others
|
2012-04-08 17:19:53 +04:00
|
|
|
_filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf'
|
2011-10-12 01:50:31 +04:00
|
|
|
} && complete -F _fbi fbi
|
|
|
|
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|