diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-06-21 12:43:50 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-06-21 12:43:50 +0200 |
commit | d66d51f1011c1ccb5350c83ed7db949d5e66ad22 (patch) | |
tree | b4f476e0289f1d11636fed592f6df01f7e1c0ba2 | |
parent | 3a0d417b9eb49290e64acbe7973d5acf1794dcf8 (diff) |
systemctl completions: Add reset-failed completion
Fixes #3153.
-rw-r--r-- | share/completions/systemctl.fish | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/share/completions/systemctl.fish b/share/completions/systemctl.fish index 8f8116db..28dd6b35 100644 --- a/share/completions/systemctl.fish +++ b/share/completions/systemctl.fish @@ -23,6 +23,15 @@ function __fish_systemd_properties end end +function __fish_systemctl_failed + if __fish_contains_opt user + # Without arguments, no "--type=" will be passed + systemctl --user list-units --state=failed --no-legend --type=$argv ^/dev/null | cut -f 1 -d ' ' + else + systemctl list-units --state=failed --no-legend --type=$argv ^/dev/null | cut -f 1 -d ' ' + end +end + complete -f -e -c systemctl # All systemctl commands complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a "$commands" @@ -42,6 +51,9 @@ for command in start stop restart try-restart reload-or-restart reload-or-try-re end end +# Handle reset-failed specially because it doesn't apply to unit-files (only units that have been tried can have failed) and a second "--state=" argument doesn't override the earlier one. +complete -f -c systemctl -n "__fish_seen_subcommand_from reset-failed" -a "(__fish_systemctl_failed)" + # Enable/Disable: Only show units with matching state for t in services sockets timers service_paths complete -f -c systemctl -n "__fish_seen_subcommand_from enable" -a "(eval __fish_systemctl_$t --state=disabled)" |