You are not logged in.
Pages: 1
Topic closed
Has anyone created a zsh command completion script for systemctl? If so, would you mind sharing on the AUR?
In my mind, it should work like so:
---
systemctl en[TAB] wic[TAB]
#evaluates to
systemctl enable wicd.service
#
systemctl rest[TAB] get[TAB][TAB]
#evaluates to
systemctl restart getty@tty
getty@tty1.service getty@tty2.service (etc)
---
For {COMMAND}, it should obviously expand to list-units, start, stop, reload, restart, try-restart, reload-or-restart, reload-or-try-restart, isolate, kill, is-active, status, show, reset-failed, enable, disable, is-enabled, load, list-jobs, cancel, monitor, dump, dot, snapshot, delete, daemon-reload, daemon-reexec, show-environment, set-environment, unset-environment, default, rescue, emergency, halt, poweroff, reboot, kexec, or exit.
As for [NAME...], it's gonna be a lot more complicated. Depending on the COMMAND, it should search through the relevant files in /lib/systemd/system/ and /etc/systemd/system, or the currently enabled services, or the currently running services, etc.
If nobody's made/in the process of making something like this, I'll give it a go when I have the time. Although I'd probably just focus on the start, restart, stop, enable, disable, poweroff and reboot, since those are the only commands I use.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
I have written one:
https://github.com/foudfou/zsh-completi … _systemctl (comments very welcome)
Note also that systemd sources include systemctl-bash-completion.sh, but I
wasn't able to use it with bashcompinit.
Offline
Awesome, thanks. I did make a start on my own, but I couldn't get it to work properly. You might want to write up a PKGBUILD and submit it to the AUR so more people can find it (here's the PKGBUILD I wrote up to install it on my PC, which'll save you ~20 seconds of writing).
AUR submission instructions are here.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
Systemctl autocomplete for zsh broke in my machine at some update, it used to be working alright.
Offline
I'm sure that has nothing to do with this two year old thread.
Offline
Indeed. Closing.
Offline
Pages: 1
Topic closed