zsh-completion.in 777 B

12345678910111213141516171819202122232425262728
  1. #compdef youtube-dl
  2. __youtube_dl() {
  3. local curcontext="$curcontext" fileopts diropts cur prev
  4. typeset -A opt_args
  5. fileopts="{{fileopts}}"
  6. diropts="{{diropts}}"
  7. cur=$words[CURRENT]
  8. case $cur in
  9. :)
  10. _arguments '*: :(::ytfavorites ::ytrecommended ::ytsubscriptions ::ytwatchlater ::ythistory)'
  11. ;;
  12. *)
  13. prev=$words[CURRENT-1]
  14. if [[ ${prev} =~ ${fileopts} ]]; then
  15. _path_files
  16. elif [[ ${prev} =~ ${diropts} ]]; then
  17. _path_files -/
  18. elif [[ ${prev} == "--recode-video" ]]; then
  19. _arguments '*: :(mp4 flv ogg webm mkv)'
  20. else
  21. _arguments '*: :({{flags}})'
  22. fi
  23. ;;
  24. esac
  25. }
  26. __youtube_dl