# pngfix completion -*- shell-script -*- proc _pngfix { var cur = '', prev = '', words = '', cword = '', split = '' _init_completion -s || return match $prev { with --suffix|--prefix return with --output _filedir return with --strip setglobal COMPREPLY = '( '$( IFS='|' compgen -W '$( "$1" --help 2>&1 | sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p" )' -- "$cur" ) ) return } $split && return if [[ $cur == -* ]] { setglobal COMPREPLY = '( '$( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return } _filedir png } && complete -F _pngfix pngfix # ex: ts=4 sw=4 et filetype=sh