3 _loginctl_all_sessions(){_sys_all_sessions=($(loginctl list-sessions | { while read a b; do echo " $a"; done; }) )}
4 _loginctl_all_users() {_sys_all_users=( $(loginctl list-users | { while read a b; do echo " $a"; done; }) )}
5 _loginctl_all_seats() {_sys_all_seats=( $(loginctl list-seats | { while read a b; do echo " $a"; done; }) )}
7 # Completion functions for SESSIONS
8 for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
9 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
11 _loginctl_all_sessions
12 compadd "$@" -a - _sys_all_sessions
16 # Completion functions for USERS
17 for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
18 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
21 compadd "$@" -a - _sys_all_users
25 # Completion functions for SEATS
26 (( $+functions[_loginctl_seats] )) || _loginctl_seats()
29 compadd "$@" -a - _sys_all_seats
31 for fun in seat-status show-seat terminate-seat ; do
32 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
36 # Completion functions for ATTACH
37 (( $+functions[_loginctl_attach] )) || _loginctl_attach()
41 _arguments -w -C -S -s \
42 ':seat:_loginctl_seats' \
46 # no loginctl completion for:
47 # [STANDALONE]='list-sessions list-users list-seats flush-devices'
49 (( $+functions[_loginctl_command] )) || _loginctl_command()
51 local -a _loginctl_cmds
53 "list-sessions:List sessions"
54 "session-status:Show session status"
55 "show-session:Show properties of one or more sessions"
56 "activate:Activate a session"
57 "lock-session:Screen lock one or more sessions"
58 "unlock-session:Screen unlock one or more sessions"
59 "terminate-session:Terminate one or more sessions"
60 "kill-session:Send signal to processes of a session"
61 "list-users:List users"
62 "user-status:Show user status"
63 "show-user:Show properties of one or more users"
64 "enable-linger:Enable linger state of one or more users"
65 "disable-linger:Disable linger state of one or more users"
66 "terminate-user:Terminate all sessions of one or more users"
67 "kill-user:Send signal to processes of a user"
68 "list-seats:List seats"
69 "seat-status:Show seat status"
70 "show-seat:Show properties of one or more seats"
71 "attach:Attach one or more devices to a seat"
72 "flush-devices:Flush all device associations"
73 "terminate-seat:Terminate all sessions on one or more seats"
76 if (( CURRENT == 1 )); then
77 _describe -t commands 'loginctl command' _loginctl_cmds || compadd "$@"
79 local curcontext="$curcontext"
81 cmd="${${_loginctl_cmds[(r)$words[1]:*]%%:*}}"
84 curcontext="${curcontext%:*:*}:loginctl-${cmd}:"
86 _call_function ret _loginctl_$cmd || _message 'no more arguments'
88 _message "unknown loginctl command: $words[1]"
96 {-h,--help}'[Show help]' \
97 '--version[Show package version]' \
98 \*{-p+,--property=}'[Show only properties by this name]:unit property' \
99 {-a,--all}'[Show all properties, including empty ones]' \
100 '--kill-who=[Who to send signal to]:killwho:(main control all)' \
101 {-s+,--signal=}'[Which signal to send]:signal:_signals' \
102 '--no-ask-password[Do not ask for system passwords]' \
103 {-H+,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
104 {-P,--privileged}'[Acquire privileges before execution]' \
105 '--no-pager[Do not pipe output into a pager]' \
106 '*::loginctl command:_loginctl_command'