shell-completion: zsh: Rework pactl completion

System Internals / PulseAudio - Tanu Kaskinen [linux.intel.com] - 26 October 2014 14:00 UTC

So far the command name has been figured out by looking one or two items back in the $words array, but I needed a way to figure out the command given an arbitrary number of parameters. I was implementing a command for removing devices from the device-manager database, and the command would take a list of devices. Since the number of devices that need to be completed can be arbitrarily large, the previous "look one or two words back" approach didn't work.

This new approach is more verbose, but I think it's also easier to follow. There's some duplication that would be easy to avoid by merging some of the commands, but I decided to not do that, to make it more obvious what the code does.

eaa80ba shell-completion: zsh: Rework pactl completion
shell-completion/zsh/_pulseaudio | 264 +++++++++++++++++++++++++++++++++-----
1 file changed, 229 insertions(+), 35 deletions(-)

Upstream: cgit.freedesktop.org


  • Share