diff options
author | dana <dana@dana.is> | 2018-12-24 12:15:38 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-01-08 15:23:37 +0100 |
commit | c501ecd70c61f5569bb775be62612521aa53f878 (patch) | |
tree | d8b7bbe730451f3a0cc2473e56f80b4914957e0a /shell-completion/zsh/_loginctl | |
parent | Add Teclast X80 PLUS (H5C5) accel mount matrix (diff) | |
download | systemd-c501ecd70c61f5569bb775be62612521aa53f878.tar.xz systemd-c501ecd70c61f5569bb775be62612521aa53f878.zip |
zsh completion: Prevent functions from clobbering each other, &c.
- Don't redefine helpers on every call
- Prefix helper names with main function name
- Adjust some helper names for consistency and convention adherance
Diffstat (limited to 'shell-completion/zsh/_loginctl')
-rw-r--r-- | shell-completion/zsh/_loginctl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/shell-completion/zsh/_loginctl b/shell-completion/zsh/_loginctl index 03dde9a891..44d6d08c98 100644 --- a/shell-completion/zsh/_loginctl +++ b/shell-completion/zsh/_loginctl @@ -1,6 +1,7 @@ #compdef loginctl # SPDX-License-Identifier: LGPL-2.1+ +(( $+functions[_loginctl_all_sessions] )) || _loginctl_all_sessions() { local session description loginctl --no-legend list-sessions | while read -r session description; do @@ -9,6 +10,7 @@ _loginctl_all_sessions() { done } +(( $+functions[_loginctl_all_users] )) || _loginctl_all_users() { local uid description loginctl --no-legend list-users | while read -r uid description; do @@ -17,6 +19,7 @@ _loginctl_all_users() { done } +(( $+functions[_loginctl_all_seats] )) || _loginctl_all_seats() { local seat description loginctl --no-legend list-seats | while read -r seat description; do @@ -107,7 +110,7 @@ done # no loginctl completion for: # [STANDALONE]='list-sessions list-users list-seats flush-devices' -(( $+functions[_loginctl_command] )) || _loginctl_command() +(( $+functions[_loginctl_commands] )) || _loginctl_commands() { local -a _loginctl_cmds _loginctl_cmds=( @@ -170,4 +173,4 @@ _arguments -s \ '--no-ask-password[Do not ask for system passwords]' \ {-n+,--lines=}'[Number of journal entries to show]' \ {-o+,--output=}'[Change journal output mode]:output modes:_sd_outputmodes' \ - '*::loginctl command:_loginctl_command' + '*::loginctl command:_loginctl_commands' |