chiark / gitweb /
tree-wide: beautify remaining copyright statements
[elogind.git] / shell-completion / bash / loginctl
index 7263f7f7bf71658d771dd9c4c60ecc5b132bc764..1f5b46620cb4b76650a35dec33a0a298fbd08075 100644 (file)
@@ -1,8 +1,9 @@
 # loginctl(1) completion                                  -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1+
 #
 # This file is part of systemd.
 #
-# Copyright 2010 Ran Benita
+# Copyright © 2010 Ran Benita
 #
 # systemd is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as published by
@@ -33,14 +34,17 @@ _loginctl () {
         local i verb comps
 
         local -A OPTS=(
-               [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version'
-                      [ARG]='--host -H --kill-who --property -p --signal -s'
+               [STANDALONE]='--all -a --help -h --no-pager --version
+                             --no-legend --no-ask-password -l --full --value'
+                      [ARG]='--host -H --kill-who --property -p --signal -s -M --machine
+                             -n --lines -o --output'
         )
 
         if __contains_word "$prev" ${OPTS[ARG]}; then
                 case $prev in
                         --signal|-s)
-                                comps=$(compgen -A signal)
+                                _signals
+                                return
                         ;;
                         --kill-who)
                                 comps='all leader'
@@ -66,11 +70,11 @@ _loginctl () {
                 [SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session'
                 [USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user'
                 [SEATS]='seat-status show-seat terminate-seat'
-                [STANDALONE]='list-sessions list-users list-seats flush-devices'
+                [STANDALONE]='list-sessions lock-sessions unlock-sessions list-users list-seats flush-devices'
                 [ATTACH]='attach'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}