aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-02-19 16:29:41 +0100
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-03-06 23:05:24 -0800
commit16e65c849cba3c62329dbf51b7e6b3e0654d8095 (patch)
tree5bac15e14425553fd78070559012a930e2de93e6 /share/completions
parent33c0d93b20cac1ab1e9ed41f659c80b4a0d577c1 (diff)
systemctl completions: Only list matching units on enable/disable
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/systemctl.fish15
1 files changed, 13 insertions, 2 deletions
diff --git a/share/completions/systemctl.fish b/share/completions/systemctl.fish
index 26faa3b5..1e5be2ee 100644
--- a/share/completions/systemctl.fish
+++ b/share/completions/systemctl.fish
@@ -6,7 +6,7 @@ set -l commands list-units list-sockets start stop reload restart try-restart re
complete -f -e -c systemctl
# All systemctl commands
-complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root'
+complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root'
#### Units commands
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a start -d 'Start one or more units'
@@ -15,7 +15,7 @@ complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a resta
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a status -d 'Runtime status about one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a enable -d 'Enable one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a disable -d 'Disable one or more units'
-for command in start stop restart status enable disable
+for command in start stop restart try-restart reload-or-restart reload-or-try-restart is-active is-failed is-enabled reenable mask loaded link list-dependencies show status
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_services)' -d 'Service'
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_sockets)' -d 'Socket'
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_mounts)' -d 'Mount'
@@ -25,6 +25,17 @@ for command in start stop restart status enable disable
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_timers)' -d 'Timer'
end
+# Enable/Disable: Only show units with matching state
+complete -f -c systemctl -n "__fish_seen_subcommand_from enable" -a '(__fish_systemctl_services --state=disabled)' -d 'Service'
+complete -f -c systemctl -n "__fish_seen_subcommand_from enable" -a '(__fish_systemctl_sockets --state=disabled)' -d 'Socket'
+complete -f -c systemctl -n "__fish_seen_subcommand_from enable" -a '(__fish_systemctl_timers --state=disabled)' -d 'Timer'
+complete -f -c systemctl -n "__fish_seen_subcommand_from enable" -a '(__fish_systemctl_service_paths --state=disabled)' -d 'Path'
+
+complete -f -c systemctl -n "__fish_seen_subcommand_from disable" -a '(__fish_systemctl_services --state=enabled)' -d 'Service'
+complete -f -c systemctl -n "__fish_seen_subcommand_from disable" -a '(__fish_systemctl_sockets --state=enabled)' -d 'Socket'
+complete -f -c systemctl -n "__fish_seen_subcommand_from disable" -a '(__fish_systemctl_timers --state=enabled)' -d 'Timer'
+complete -f -c systemctl -n "__fish_seen_subcommand_from disable" -a '(__fish_systemctl_service_paths --state=enabled)' -d 'Path'
+
# These are useless for the other commands
# .device in particular creates too much noise
complete -f -c systemctl -n "__fish_seen_subcommand_from status" -a '(__fish_systemctl_devices)' -d 'Device'