Commit graph

10 commits

Author SHA1 Message Date
Peter Meerwald
6d1fd4d1aa pactl: Remove deprecated 'stat' behaviour
the stat command should only output statistics, not info

behaviour was deprecated anno 2011 in 8ace9185 "pactl: Make stat backwards
compatible" -- fix this now

v2: (thanks Tanu Kaskinen):
* adjust shell completion

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-04 22:22:19 +01:00
Tanu Kaskinen
eaa80baea9 shell-completion: zsh: Rework pactl completion
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.
2014-10-26 21:00:26 +02:00
Tanu Kaskinen
414646769d shell-completion: zsh: Mark a variable as local
Variables are global by default, and we certainly don't want
_pactl_commands to be a global variable.
2014-10-26 21:00:23 +02:00
Tanu Kaskinen
64d17a6b0a shell-completion: zsh: Add "=" to the end of some command options
Without the equals sign, only the "--server foo" form is recognized,
so the "--server=foo" form doesn't get completion support.
2014-08-17 09:30:16 +03:00
Tanu Kaskinen
db6d5011cd shell-completion: zsh: Use -S and -A with _arguments
-S makes the option parser to not try parsing arguments as options
after "--" has appeared in the command line.

-A "-*" makes the option parser to not try parsing arguments as
options after the first non-option argument. The "-*" pattern means
that if there are unrecognized parameters that look like options
(i.e. start with a dash), those should not terminate the option
parsing.
2014-08-17 09:30:16 +03:00
Tanu Kaskinen
cd3cae9285 shell-completion: zsh: Don't use multiple option sets for one command
The options were divided to multiple sets to prevent (or at least try
to prevent) completing e.g. --server after -s was already given. This,
however, caused problems, because after the user had written
"pactl --server foo", further completions stopped to work. The
"server" option set didn't contain any other options, so once Zsh
detected that the "server" option set was in use, it thought that no
other options were valid.

The special casing for "-s", "-n", "--server" and "--client-*" at the
end of _pactl_completion() was probably an attempt to deal with this
problem. Those special cases are unnecessary now that the option
specification given to _arguments is more correct.
2014-08-17 09:26:55 +03:00
Tanu Kaskinen
74c724db05 shell-completion: zsh: Don't say "this help" when it's a different help
The option descriptions that Zsh prints are not the same thing as the
help text that pactl, pacmd etc. print when given --help.
2014-08-17 09:20:51 +03:00
Tanu Kaskinen
1f9d4cbe93 shell-completion: zsh: Support also --server in remote detection
_set_remote() is supposed to find out if a remote server has been
specified on the command line, but previously it only checked for -s
and ignored --server, causing the completion code to connect to the
local server instead when it should have connected to the remote
server to get the data for the completions.
2014-08-17 09:20:51 +03:00
Tanu Kaskinen
09e9d13e2d shell-completion: zsh: Move duplicated code into a function
This is just refactoring, no functional changes.
2014-08-17 09:20:51 +03:00
Tanu Kaskinen
be8171be79 shell-completion: Install the Zsh completions
This makes the Zsh completions work out-of-the-box. I also moved
pulseaudio-zsh-completion.zsh to zsh/_pulseaudio to be in line with
the common naming convention of Zsh completion files.
2014-08-17 08:24:47 +03:00