X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=shell-completion%2Fbash%2Fsystemctl;h=e1c842006e3ee885401723d813425e84355e3ad6;hp=517b49a6afda79ed587518cbf80431660d1f71bd;hb=becad8f1ed696433b9841cbb9c4603c303338d30;hpb=a72d698d0d9ff9c158155b44cdc77376df31a317 diff --git a/shell-completion/bash/systemctl b/shell-completion/bash/systemctl index 517b49a6a..e1c842006 100644 --- a/shell-completion/bash/systemctl +++ b/shell-completion/bash/systemctl @@ -56,7 +56,7 @@ __get_all_units () { __systemctl $1 list-units --all \ __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } __get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \ - | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed " ]] && echo " $a"; done; }; } + | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; } __get_failed_units () { __systemctl $1 list-units \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } __get_enabled_units () { __systemctl $1 list-unit-files \ @@ -73,8 +73,8 @@ _systemctl () { local -A OPTS=( [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall - --quiet -q --privileged -P --system --user --version --runtime' - [ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --root' + --quiet -q --privileged -P --system --user --version --runtime --recursive -r' + [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -91,12 +91,14 @@ _systemctl () { --type|-t) comps='automount device mount path service snapshot socket swap target timer' ;; + --state) + comps='loaded not-found stub + active inactive + dead elapsed exited listening mounted plugged running waiting' + ;; --kill-who) comps='all control main' ;; - --kill-mode) - comps='control-group process' - ;; --root) comps=$(compgen -A directory -- "$cur" ) compopt -o filenames @@ -118,7 +120,7 @@ _systemctl () { fi local -A VERBS=( - [ALL_UNITS]='is-active is-failed is-enabled status show mask preset help list-dependencies' + [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies' [ENABLED_UNITS]='disable' [DISABLED_UNITS]='enable' [REENABLABLE_UNITS]='reenable' @@ -132,16 +134,16 @@ _systemctl () { [JOBS]='cancel' [SNAPSHOTS]='delete' [ENVS]='set-environment unset-environment' - [STANDALONE]='daemon-reexec daemon-reload default dump + [STANDALONE]='daemon-reexec daemon-reload default emergency exit halt hibernate hybrid-sleep kexec list-jobs - list-units list-unit-files poweroff reboot rescue - show-environment suspend get-default' - [NAME]='snapshot load' + list-sockets list-timers list-units list-unit-files poweroff + reboot rescue show-environment suspend get-default' + [NAME]='snapshot' [FILE]='link' [TARGETS]='set-default' ) - 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]} @@ -149,7 +151,7 @@ _systemctl () { fi done - if [[ -z $verb ]]; then + if [[ -z $verb ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then