3     local cur prev opts fileopts diropts keywords
 
   5     cur="${COMP_WORDS[COMP_CWORD]}"
 
   6     prev="${COMP_WORDS[COMP_CWORD-1]}"
 
   8     keywords=":ytfavorites :ytrecommended :ytsubscriptions :ytwatchlater :ythistory"
 
   9     fileopts="-a|--batch-file|--download-archive|--cookies|--load-info"
 
  12     if [[ ${prev} =~ ${fileopts} ]]; then
 
  13         COMPREPLY=( $(compgen -f -- ${cur}) )
 
  15     elif [[ ${prev} =~ ${diropts} ]]; then
 
  16         COMPREPLY=( $(compgen -d -- ${cur}) )
 
  20     if [[ ${cur} =~ : ]]; then
 
  21         COMPREPLY=( $(compgen -W "${keywords}" -- ${cur}) )
 
  23     elif [[ ${cur} == * ]] ; then
 
  24         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
 
  29 complete -F __youtube_dl youtube-dl