fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
5d37698ef
master
1# localization: skip(private) 2function __fish_systemctl_services 3if not type -q systemctl 4return 5end 6 7# We don't want to complete with ANSI color codes 8set -lu SYSTEMD_COLORS 9 10# use the user specified mode, also exclude user defined alias 11set -l tokens( commandline -xp) 12# for determining whether user is using `journalctl` 13set -l command$tokens [ 1 ] 14set -l mode 15for tin $tokens [ 2 .. ] 16switch $t 17case --system --user 18set mode$t 19case --global 20# `journalctl` does not have `global` option 21if test " $command " != journalctl 22set mode$t 23end 24case -- 25break 26end 27end 28 29set -l common_args --full --no-legend --no-pager --plain --type=service 30begin 31# `list-unit-files` will also show disabled units 32systemctl $mode list-unit-files$common_args 33# `list-units` will not show disabled units but will show instances (like wpa_supplicant@wlan0.service) 34systemctl $mode list-units --state=loaded$common_args 35end 2> /dev/null| string split -f1 ' ' 36end