]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_busctl
shell-completion: busctl
[thirdparty/systemd.git] / shell-completion / zsh / _busctl
1 #compdef busctl
2
3 # hostnamectl(1) completion -*- shell-script -*-
4 #
5 # This file is part of systemd.
6 #
7 # Copyright 2013 Zbigniew Jędrzejewski-Szmek
8 #
9 # systemd is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU Lesser General Public License as published by
11 # the Free Software Foundation; either version 2.1 of the License, or
12 # (at your option) any later version.
13 #
14 # systemd is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
21
22 (( $+functions[_busctl_command] )) || _busctl_command()
23 {
24 local -a _busctl_cmds
25 _busctl_cmds=(
26 "list:List bus names"
27 "monitor:Show bus traffic"
28 )
29 if (( CURRENT == 1 )); then
30 _describe -t commands 'busctl command' _busctl_cmds || compadd "$@"
31 else
32 local curcontext="$curcontext"
33 cmd="${${_busctl_cmds[(r)$words[1]:*]%%:*}}"
34 if (( $+functions[_busctl_$cmd] )); then
35 _busctl_$cmd
36 else
37 _message "no more options"
38 fi
39 fi
40 }
41
42 _arguments \
43 {-h,--help}'[Prints a short help text and exits.]' \
44 '--version[Prints a short version string and exits.]' \
45 '--no-pager[Do not pipe output into a pager]' \
46 '--system[Connect to system manager]' \
47 '--user[Connect to user service manager]' \
48 {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
49 {-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \
50 '--address=[Connect to the bus specified by address]:address' \
51 '--no-unique[Only show well-known names]' \
52 '--no-machine[Do not show machine IDs]' \
53 '--match=[Only show matching messages]:match' \
54 '*::busctl command:_busctl_command'