bash-completion.in 451 B

123456789101112131415161718
  1. __youtube_dl()
  2. {
  3. local cur prev opts
  4. COMPREPLY=()
  5. cur="${COMP_WORDS[COMP_CWORD]}"
  6. opts="{{flags}}"
  7. keywords=":ytfavorites :ytrecommended :ytsubscriptions :ytwatchlater"
  8. if [[ ${cur} =~ : ]]; then
  9. COMPREPLY=( $(compgen -W "${keywords}" -- ${cur}) )
  10. return 0
  11. elif [[ ${cur} == * ]] ; then
  12. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  13. return 0
  14. fi
  15. }
  16. complete -F __youtube_dl youtube-dl