You are not logged in.

#1 2011-05-20 16:30:48

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,135

systemctl (systemd) zsh autocomplete

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.

smile


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Online

#2 2011-08-25 20:59:45

foudfou
Member
Registered: 2011-08-25
Posts: 3

Re: systemctl (systemd) zsh autocomplete

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

#3 2011-08-26 02:08:10

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,135

Re: systemctl (systemd) zsh autocomplete

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: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Online

#4 2013-09-26 08:24:22

vermelho
Member
Registered: 2012-05-02
Posts: 8

Re: systemctl (systemd) zsh autocomplete

Systemctl autocomplete for zsh broke in my machine at some update, it used to be working alright.

Offline

#5 2013-09-26 08:30:14

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,894

Re: systemctl (systemd) zsh autocomplete

I'm sure that has nothing to do with this two year old thread.

https://wiki.archlinux.org/index.php/Fo … Bumping.22

Offline

#6 2013-09-26 08:33:29

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,531
Website

Re: systemctl (systemd) zsh autocomplete

Indeed. Closing.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

Board footer

Powered by FluxBB