diff options
author | Philip Sequeira <phsequei@gmail.com> | 2016-04-15 16:51:00 -0400 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-04-16 18:47:15 +0200 |
commit | d797f7def9086d1af368d3e20f6b26e2a94f9ac1 (patch) | |
tree | 43a092c37396e0013b6cfb39b8e4d06a2b2b7d38 /TOOLS/zsh.pl | |
parent | 44644e69f04b40142c7ab0930c9ec3856c006a56 (diff) | |
download | mpv-d797f7def9086d1af368d3e20f6b26e2a94f9ac1.tar.bz2 mpv-d797f7def9086d1af368d3e20f6b26e2a94f9ac1.tar.xz |
TOOLS/zsh.pl: complete --audio-device
Diffstat (limited to 'TOOLS/zsh.pl')
-rwxr-xr-x | TOOLS/zsh.pl | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/TOOLS/zsh.pl b/TOOLS/zsh.pl index d6f7714174..50890f5941 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 '*,' @@ -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; |