[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] zsh-completion Add completion of sample names
PulseAudio Marge Bot
gitlab at gitlab.freedesktop.org
Fri Feb 12 16:55:00 UTC 2021
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
faa1a7e0 by Paul Seyfert at 2021-02-10T19:37:07+01:00
zsh-completion Add completion of sample names
This closes #201.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/501>
- - - - -
1 changed file:
- shell-completion/zsh/_pulseaudio
Changes:
=====================================
shell-completion/zsh/_pulseaudio
=====================================
@@ -34,6 +34,7 @@ _devices() {
case $words[$((CURRENT - 2))] in
move-sink-input) cmd=('sinks');;
move-source-output) cmd=('sources');;
+ play-sample) cmd=('sinks');;
esac
elif [[ $service == (pacat|paplay|parec|parecord) ]]; then
@@ -158,6 +159,13 @@ _ports() {
_describe 'port list' _port_list
}
+_sample_names() {
+ local -a _sample_names
+ sample_names=(${${${(f)"$(_call_program samples_tag "pactl $remote list samples short 2> /dev/null")"}##[[:digit:]]#[[:blank:]]#}%%[[:blank:]]*})
+
+ _wanted pactl-samples expl 'sample list' compadd $sample_names
+}
+
_cards(){
local -a _card_list
local _card _cad_name
@@ -306,10 +314,10 @@ _pactl_completion() {
_play_sample_parameter() {
if ((CURRENT == 2)); then
# We're completing the first parameter after "play-sample".
- # TODO: Implement sample name completion.
+ _sample_names
elif ((CURRENT == 3)); then
# We're completing the second parameter after "play-sample".
- # TODO: Implement sink name completion.
+ _devices
fi
}
@@ -472,7 +480,7 @@ _pactl_completion() {
list) _list_parameter;;
upload-sample) if ((CURRENT == 2)); then _files; fi;;
play-sample) _play_sample_parameter;;
- remove-sample) ;; # TODO: Implement sample name completion.
+ remove-sample) if ((CURRENT == 2)); then _sample_names; fi;;
load-module) _load_module_parameter;;
unload-module) if ((CURRENT == 2)); then _loaded_modules; fi;;
move-sink-input) _move_sink_input_parameter;;
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/faa1a7e042d3900c6f1e2caaa138093c02548919
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/faa1a7e042d3900c6f1e2caaa138093c02548919
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210212/418cbadf/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list