diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
commit | ad56f2c46ac6deec86870ec10f2a11a644df07d4 (patch) | |
tree | 89f2d90c5586560911e67c872b530c77f151168d /TOOLS/zsh.pl | |
parent | 0536841647ef7931bffb4386d8ffbb5b2b568e8a (diff) | |
parent | 393bb2a565dc1e27812e1dd20747814892f80da2 (diff) | |
download | mpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.bz2 mpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'TOOLS/zsh.pl')
-rwxr-xr-x | TOOLS/zsh.pl | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/TOOLS/zsh.pl b/TOOLS/zsh.pl index d6f7714174..306e9765b7 100755 --- a/TOOLS/zsh.pl +++ b/TOOLS/zsh.pl @@ -36,7 +36,8 @@ chomp $vf_str; $protos_str = join(' ', @protos); -my $profile_comp = <<'EOS'; +my $runtime_completions = <<'EOS'; + profile|show-profile) local -a profiles local current for current in "${(@f)$($words[1] --profile=help)}"; do @@ -63,8 +64,25 @@ my $profile_comp = <<'EOS'; profiles=($profiles 'help[list profiles]') _values -s , 'profile(s)' $profiles && rc=0 fi + ;; + + audio-device) + local -a audio_devices + local current + for current in "${(@f)$($words[1] --audio-device=help)}"; do + current=${current//\*/\\\*} + current=${current//\:/\\\:} + current=${current//\[/\\\[} + current=${current//\]/\\\]} + if [[ $current =~ ' '\'([^\']*)\'' \('(.*)'\)' ]]; then + audio_devices=($audio_devices "$match[1][$match[2]]") + fi + done + audio_devices=($audio_devices 'help[list audio devices]') + _values 'audio device' $audio_devices && rc=0 + ;; EOS -chomp $profile_comp; +chomp $runtime_completions; my $tmpl = <<"EOS"; #compdef mpv @@ -111,9 +129,7 @@ $vf_str && rc=0 ;; - profile|show-profile) -$profile_comp - ;; +$runtime_completions files) compset -P '*,' @@ -126,7 +142,7 @@ $profile_comp _tags files urls while _tags; do _requested files expl 'media file' _files -g \\ - "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|ogv|opus|qt|rm|ts|vob|wav|webm|wma|wmv|wv)(-.)" && rc=0 + "*.(#i)(asf|asx|avi|f4v|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|ogv|opus|qt|rm|ts|vob|wav|webm|wma|wmv|wv)(-.)" && rc=0 if _requested urls; then while _next_label urls expl URL; do _urls "\$expl[@]" && rc=0 @@ -189,7 +205,7 @@ sub parse_main_opts { } } elsif ($line =~ /\[file\]/) { $entry .= '->files'; - } elsif ($name =~ /^--(ao|vo|af|vf|profile|show-profile)$/) { + } elsif ($name =~ /^--(ao|vo|af|vf|profile|show-profile|audio-device)$/) { $entry .= "->$1"; } push @list, $entry; |