summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2014-06-30 20:42:00 -0400
committerAlessandro Ghedini <alessandro@ghedini.me>2014-07-03 11:03:56 +0200
commit29b047da6fd504329117c680cd8fd4ff53f587c8 (patch)
treec96d99c8f36efb7491bb77c779b969c555a78d94
parent17d65f9aff29864368cc2c9becbd0ce4cbfac409 (diff)
downloadmpv-29b047da6fd504329117c680cd8fd4ff53f587c8.tar.bz2
mpv-29b047da6fd504329117c680cd8fd4ff53f587c8.tar.xz
TOOLS/zsh.pl: complete URL schemes based on --list-protocols
-rwxr-xr-xTOOLS/zsh.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/TOOLS/zsh.pl b/TOOLS/zsh.pl
index 572c2dc040..15c181f5f1 100755
--- a/TOOLS/zsh.pl
+++ b/TOOLS/zsh.pl
@@ -15,7 +15,9 @@ my @vo = parse_opts("$mpv --vo=help", '^ ([^\s\:]*)\s*: (.*)');
my @af = parse_opts("$mpv --af=help", '^ ([^\s\:]*)\s*: (.*)');
my @vf = parse_opts("$mpv --vf=help", '^ ([^\s\:]*)\s*: (.*)');
-my ($opts_str, $ao_str, $vo_str, $af_str, $vf_str);
+my @protos = parse_opts("$mpv --list-protocols", '^ ([^\s]*)');
+
+my ($opts_str, $ao_str, $vo_str, $af_str, $vf_str, $protos_str);
$opts_str .= qq{ '$_' \\\n} foreach (@opts);
chomp $opts_str;
@@ -32,6 +34,9 @@ chomp $af_str;
$vf_str .= qq{ '$_' \\\n} foreach (@vf);
chomp $vf_str;
+$protos_str .= qq{$_ } foreach (@protos);
+chomp $protos_str;
+
my $tmpl = <<"EOS";
#compdef mpv
@@ -86,7 +91,7 @@ $vf_str
if _requested urls; then
while _next_label urls expl URL; do
_urls "\$expl[@]" && ret=0
- compadd -S '' "\$expl[@]" \{dvd,vcd,cdda,cddb,tv\}:// && ret=0
+ compadd -S '' "\$expl[@]" $protos_str && ret=0
done
fi
(( ret )) || return 0