zsh-completion.in 864 B

123456789101112131415161718192021222324252627282930
  1. #compdef yt-dlp
  2. __yt_dlp() {
  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} == "--remux-video" ]]; then
  19. _arguments '*: :(mp4 mkv)'
  20. elif [[ ${prev} == "--recode-video" ]]; then
  21. _arguments '*: :(mp4 flv ogg webm mkv)'
  22. else
  23. _arguments '*: :({{flags}})'
  24. fi
  25. ;;
  26. esac
  27. }
  28. __yt_dlp