[pulseaudio-discuss] [PATCH] shell-completion: Add completion for parec

Damir Jelić poljar at termina.org.uk
Sat May 24 13:06:25 PDT 2014


On Sat, May 24, 2014 at 01:05:52PM +0300, Tanu Kaskinen wrote:
> ---
>  shell-completion/pulseaudio-bash-completion.sh | 2 +-
>  shell-completion/pulseaudio-zsh-completion.zsh | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/shell-completion/pulseaudio-bash-completion.sh b/shell-completion/pulseaudio-bash-completion.sh
> index 43f4a2c..7775b08 100644
> --- a/shell-completion/pulseaudio-bash-completion.sh
> +++ b/shell-completion/pulseaudio-bash-completion.sh
> @@ -492,7 +492,7 @@ _pacat () {
>              ;;
>      esac
>  }
> -complete -F _pacat pacat paplay parecord
> +complete -F _pacat pacat paplay parec parecord

ACK.

>  _pulseaudio()
>  {
> diff --git a/shell-completion/pulseaudio-zsh-completion.zsh b/shell-completion/pulseaudio-zsh-completion.zsh
> index abc443a..4101a21 100644
> --- a/shell-completion/pulseaudio-zsh-completion.zsh
> +++ b/shell-completion/pulseaudio-zsh-completion.zsh
> @@ -541,6 +541,7 @@ _pulseaudio() {
>          pacmd) _pacmd_completion;;
>          pacat) _pacat_completion;;
>          paplay)_pacat_completion;;
> +        parec) _pacat_completion;;
>          parecord)_pacat_completion;;
>          padsp) _padsp_completion;;
>          pasuspender) _pasuspender_completion;;

This one needs a little bit more work. The first line in the file
defines all the 'commands' that this completion file supports (the
#compdef one).

The _pulseaudio function is just a dispatcher function that looks up the
name of the calling command ($service is equivalent to argv[0]) and
calls the real worker functions, so this part is ok but the _devices 
function uses $service as well to complete based on context, e.g. 
when we complete devices for parec we only want sources, for paplay only sinks.

Modified patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-shell-completion-Add-completion-for-parec.patch
Type: text/x-diff
Size: 2687 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140524/f4baabb8/attachment.patch>


More information about the pulseaudio-discuss mailing list