# Defined in /tmp/fish.HQIyJ6/ydl.fish @ line 2
function ydl
  set -l addargs --extract-audio --keep-video
  set -l url $argv[1]

  echo "args = $argv[1] -- $argv[2]"

  if contains -- "-a" $argv
      echo "has -a"
      set addargs "--extract-audio"
      set url $argv[2]
  end

  if contains -- "-v" $argv
      echo "has -v"
      set -e addargs
      set url $argv[2]
  end

  echo youtube-dl $addargs -o "%(title)s.%(ext)s" --add-metadata "$url"
  youtube-dl $addargs -o "%(title)s.%(ext)s" --add-metadata "$url"
  #rm -f "*.f???.*"
  fd ".*\.f...\..*" -X rm
end
