strom/fish-misc
Archived
1
0
Fork 0
This repository has been archived on 2023-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
fish-misc/functions/ytdl.fish

27 lines
567 B
Fish

# vim: ft=fish ts=4 sw=4 noet
function ytdl --description 'launch ytdl with specific configuration file selected through fzf'
if not command -sq youtube-dl or not command -sq fzf
return 1
end
set base "$XDG_CONFIG_HOME/youtube-dl"
set profile (
for conf in $base/*.conf
echo (string split -r -m1 . (string split -r -m1 / $conf)[2])[1]
end | command fzf --select-1 --exit-0
)
if [ -z profile ]
return 2
end
set conf $base/$profile.conf
if [ ! -r $conf ]
return 3
end
echo $conf
command youtube-dl --config-location $conf $argv[1..]
end