mirror of https://github.com/mpv-player/mpv
TOOLS/zsh.pl: complete --audio-device
This commit is contained in:
parent
44644e69f0
commit
d797f7def9
28
TOOLS/zsh.pl
28
TOOLS/zsh.pl
|
@ -36,7 +36,8 @@ chomp $vf_str;
|
||||||
|
|
||||||
$protos_str = join(' ', @protos);
|
$protos_str = join(' ', @protos);
|
||||||
|
|
||||||
my $profile_comp = <<'EOS';
|
my $runtime_completions = <<'EOS';
|
||||||
|
profile|show-profile)
|
||||||
local -a profiles
|
local -a profiles
|
||||||
local current
|
local current
|
||||||
for current in "${(@f)$($words[1] --profile=help)}"; do
|
for current in "${(@f)$($words[1] --profile=help)}"; do
|
||||||
|
@ -63,8 +64,25 @@ my $profile_comp = <<'EOS';
|
||||||
profiles=($profiles 'help[list profiles]')
|
profiles=($profiles 'help[list profiles]')
|
||||||
_values -s , 'profile(s)' $profiles && rc=0
|
_values -s , 'profile(s)' $profiles && rc=0
|
||||||
fi
|
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
|
EOS
|
||||||
chomp $profile_comp;
|
chomp $runtime_completions;
|
||||||
|
|
||||||
my $tmpl = <<"EOS";
|
my $tmpl = <<"EOS";
|
||||||
#compdef mpv
|
#compdef mpv
|
||||||
|
@ -111,9 +129,7 @@ $vf_str
|
||||||
&& rc=0
|
&& rc=0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
profile|show-profile)
|
$runtime_completions
|
||||||
$profile_comp
|
|
||||||
;;
|
|
||||||
|
|
||||||
files)
|
files)
|
||||||
compset -P '*,'
|
compset -P '*,'
|
||||||
|
@ -189,7 +205,7 @@ sub parse_main_opts {
|
||||||
}
|
}
|
||||||
} elsif ($line =~ /\[file\]/) {
|
} elsif ($line =~ /\[file\]/) {
|
||||||
$entry .= '->files';
|
$entry .= '->files';
|
||||||
} elsif ($name =~ /^--(ao|vo|af|vf|profile|show-profile)$/) {
|
} elsif ($name =~ /^--(ao|vo|af|vf|profile|show-profile|audio-device)$/) {
|
||||||
$entry .= "->$1";
|
$entry .= "->$1";
|
||||||
}
|
}
|
||||||
push @list, $entry;
|
push @list, $entry;
|
||||||
|
|
Loading…
Reference in New Issue