mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-20 06:30:04 +01:00
wpctl: add bash completions
This commit is contained in:
parent
551353482a
commit
7ca21699a9
2 changed files with 35 additions and 0 deletions
|
|
@ -4,6 +4,11 @@ executable('wpctl',
|
||||||
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep, libintl_dep],
|
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep, libintl_dep],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install_data('shell-completion/wpctl.bash',
|
||||||
|
install_dir: get_option('datadir') / 'bash-completion/completions',
|
||||||
|
rename: 'wpctl'
|
||||||
|
)
|
||||||
|
|
||||||
install_data('shell-completion/wpctl.zsh',
|
install_data('shell-completion/wpctl.zsh',
|
||||||
install_dir: get_option('datadir') / 'zsh/site-functions',
|
install_dir: get_option('datadir') / 'zsh/site-functions',
|
||||||
rename: '_wpctl'
|
rename: '_wpctl'
|
||||||
|
|
|
||||||
30
src/tools/shell-completion/wpctl.bash
Normal file
30
src/tools/shell-completion/wpctl.bash
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
_wpctl_pw_defaults() {
|
||||||
|
local defaults="@DEFAULT_SINK@ @DEFAULT_AUDIO_SINK@ @DEFAULT_SOURCE@
|
||||||
|
@DEFAULT_AUDIO_SOURCE@ @DEFAULT_VIDEO_SOURCE@"
|
||||||
|
COMPREPLY+=($(compgen -W "$defaults" -- "$cur"))
|
||||||
|
}
|
||||||
|
|
||||||
|
_wpctl() {
|
||||||
|
local cur prev words cword
|
||||||
|
local commands="status get-volume inspect set-default set-volume set-mute
|
||||||
|
set-profile set-route clear-default settings set-log-level"
|
||||||
|
|
||||||
|
_init_completion -n = || return
|
||||||
|
|
||||||
|
if [[ ${#COMP_WORDS[@]} -eq 2 ]]; then
|
||||||
|
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
get-volume | inspect | set-volume | set-mute | set-profile | set-route)
|
||||||
|
_wpctl_pw_defaults
|
||||||
|
;;
|
||||||
|
|
||||||
|
clear-default)
|
||||||
|
COMPREPLY+=($(compgen -W "0 1 2" -- "$cur"))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _wpctl wpctl
|
||||||
Loading…
Add table
Reference in a new issue