27 lines
567 B
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
|