From d797f7def9086d1af368d3e20f6b26e2a94f9ac1 Mon Sep 17 00:00:00 2001 From: Philip Sequeira Date: Fri, 15 Apr 2016 16:51:00 -0400 Subject: TOOLS/zsh.pl: complete --audio-device --- TOOLS/zsh.pl | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'TOOLS/zsh.pl') 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; -- cgit v1.2.3