_lrfviewer()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="--version -h --help --verbose --visual-debug --disable-hyphenation --white-background --profile"
    pics="@(BMP|GIF|JPEG|JPG|PNG|bmp|gif|jpeg|jpg|png)"

    case "${prev}" in
      --cover )
           _filedir ${pics}
           return 0
         ;;
    
    esac

    case "${cur}" in
      --cover )
           _filedir ${pics}
           return 0
         ;;
    
      -* )
         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
         return 0
         ;;
      *  )
        _filedir '@(LRF|lrf)'
        return 0
        ;;
    esac

}
complete -o filenames -F _lrfviewer lrfviewer

