diff options
author | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2012-12-27 17:39:48 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-01-04 00:33:25 +0100 |
commit | 1a0fce458d3b45624c5817006735d59a5689ef83 (patch) | |
tree | af19cc44d5034336094be2bfa5e807a2e725fbc0 /shell-completion | |
parent | c8be47e81568629f8ae9135ab2219de0180c04ac (diff) |
systemctl: add is-failed
Adds is-failed to join is-active and is-enabled.
I grabbed this one from the todo list. Most of the functionality was
already there for is-active. I just needed to make check_one_unit take
the states to check for as an argument instead of the hardcoded
"active" and "reloading".
is-failed will return 1 if none of the units given are failed. This is
different from is-active which will return 3 if none of the units
given are active. It returns 3 with this comment:
/* According to LSB: "program is not running" */
As that does not make sense when looking for failed units I simply
chose 1 instead.
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/systemd-bash-completion.sh | 2 | ||||
-rw-r--r-- | shell-completion/systemd-zsh-completion.zsh | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/shell-completion/systemd-bash-completion.sh b/shell-completion/systemd-bash-completion.sh index a5df3bf985..52dc72b04f 100644 --- a/shell-completion/systemd-bash-completion.sh +++ b/shell-completion/systemd-bash-completion.sh @@ -100,7 +100,7 @@ _systemctl () { fi local -A VERBS=( - [ALL_UNITS]='is-active is-enabled status show mask preset' + [ALL_UNITS]='is-active is-failed is-enabled status show mask preset' [ENABLED_UNITS]='disable reenable' [DISABLED_UNITS]='enable' [FAILED_UNITS]='reset-failed' diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh index ee68ac7576..d5fb850cdb 100644 --- a/shell-completion/systemd-zsh-completion.zsh +++ b/shell-completion/systemd-zsh-completion.zsh @@ -335,6 +335,7 @@ _outputmodes() { "isolate:Start one unit and stop all others" "kill:Send signal to processes of a unit" "is-active:Check whether units are active" + "is-failed:Check whether units are failed" "status:Show runtime status of one or more units" "show:Show properties of one or more units/jobs or the manager" "reset-failed:Reset failed state for all, one, or more units" @@ -457,7 +458,7 @@ _systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files _systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo "$a"; done; }) )} # Completion functions for ALL_UNITS -for fun in is-active is-enabled status show mask preset ; do +for fun in is-active is-failed is-enabled status show mask preset ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { _systemctl_really_all_units |