fish: Add fish-systemctl

https://github.com/wawa19933/fish-systemd

We do not use any plugin manager so just add this manually.
This commit is contained in:
Sanchayan Maity 2022-09-30 20:16:31 +05:30
parent edf40d4e04
commit cb12ad28ab
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,4 @@
abbr -a -g sc systemctl
abbr -a -g scu systemctl --user
abbr -a -g jr journalctl
abbr -a -g jru journalctl --user

View file

@ -0,0 +1,21 @@
function systemctl --description 'Wraps privileged and user systemctl commands to use sudo when necessary' -w systemctl
set -l user_commands \
list-units list-unit-files list-jobs list-timers \
list-sockets list-dependencies list-machines \
is-active is-enabled is-failed \
status show help get-default show-environment cat
set -l root_commands start stop reload restart try-restart \
reload-or-restart try-reload-or-restart isolate kill clean \
set-property reset-failed enable disable reenable preset \
preset-all mask unmask link revert add-wants add-requires \
edit set-default cancel set-environment unset-environment import-environment \
daemon-reload daemon-reexec default rescue emergency halt poweroff reboot \
kexec exit switch-root suspend hibernate hybrid-sleep suspend-then-hibernate
if contains -- --user $argv; or not contains -- $argv[1] $root_commands
command systemctl $argv
else
command sudo systemctl $argv
end
end