1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
The systemd System and Service Manager
Go to file
Ran Benita 42bb3074fe add bash completion for systemctl --system
I've been playing recently with systemd on Arch, and had much fun. But
soon, alas, my fingers started to ache from repeatedly writing
systemctl restart some-long-service.service. So, I wrote a completion
script. I figured other people may want to use it, so I prepared a
patch against systemd-git (attached).

There are some notes/disclaimers, however:

- It requires bash>=4.0, sed, grep and awk. A bash-completion package
is not strictly needed; sourcing the file is enough.
- It wouldn't work properly with --session, as I had no way to test it.
- It uses the output of systemctl list-units directly when that's
enough, but also runs systemctl show when completing on some verbs
(for example, to check for AllowIsolate=yes). This /may/ be somewhat
slow once there are many units, since it calls a dbus method on each
one. Is there a faster way to have that information?
- The code is perhaps a bit long and messy; honestly, I blame the tool ;)

One way to improve on the situation is to integrate some completion
code in systemctl itself, the way e.g. gdbus, gsettings and django do
it. This will allow for finer grained and faster completions, and it
won't be necessary to keep the verb/option tables in sync with some
other file. But it does mean adding all of this code in C. If this is
acceptable, I'll try to have a go at it.

Finally, a couple of completion tips I run into:
- If you alias systemctl to, say, sctl, you get completions on that
too by running to following command:
complete -F _systemctl sctl
- Add the following line to your .inputrc, to have the completion show
after only a single tab press:
set show-all-if-ambiguous on
It makes the shell quite more pleasant.

Hope it's good enough!

Ran
2010-11-10 23:02:44 +01:00
m4 git: ignore libtool m4 files 2010-06-18 04:23:33 +02:00
man man: minor tmpfiles(5) updates and reindenting 2010-11-10 23:01:20 +01:00
src add bash completion for systemctl --system 2010-11-10 23:02:44 +01:00
test1 exec: replace OOMAdjust= by OOMScoreAdjust= to follow new kernel interface 2010-08-31 01:33:43 +02:00
test2 test: update test-engine.c to work again 2010-06-03 03:01:29 +02:00
tmpfiles.d tmpfiles: Don't clean /var/lock/subsys; it is not aged content 2010-10-25 23:25:51 +02:00
units readahead: shortcut replay if /.readahead doesn't exist 2010-10-31 00:53:12 +02:00
.gitignore ac-power: make ac-power a proper binary that scripts can call 2010-11-10 22:38:44 +01:00
autogen.sh use common names: fixme -> TODO, bootstrap.sh -> autogen.sh 2010-10-07 19:30:54 +02:00
CODING_STYLE CODING_STYLE: minor updates 2010-02-14 22:44:51 +01:00
configure.ac ubuntu: Treat Ubuntu as a distinct distro in configure.ac etc 2010-10-25 21:09:56 +02:00
DISTRO_PORTING main: replace --running-as= by --session and --system do mimic related tools and D-Bus 2010-07-13 18:57:58 +02:00
LICENSE license: add GPLv2+ license blurbs everwhere 2010-02-03 13:03:47 +01:00
Makefile.am add bash completion for systemctl --system 2010-11-10 23:02:44 +01:00
README shutdown: create /var/run/nologin instead of /etc/nologin which is supported since PAM 1.1.2 2010-10-07 20:46:02 +02:00
systemd.pc.in build-sys: fix directory creation of a few dirs 2010-06-22 05:43:07 +02:00
TODO service: delay automatic restart if job is pending 2010-11-10 22:38:43 +01:00

systemd System and Session Manager

DETAILS:
        http://0pointer.de/blog/projects/systemd.html

WEB SITE:
        http://www.freedesktop.org/wiki/Software/systemd

GIT:
        git://anongit.freedesktop.org/systemd
        ssh://git.freedesktop.org/git/systemd

GITWEB:
        http://cgit.freedesktop.org/systemd/

MAILING LIST:
        http://lists.freedesktop.org/mailman/listinfo/systemd-devel
        http://lists.freedesktop.org/mailman/listinfo/systemd-commits

IRC:
        #systemd on irc.freenode.org

BUG REPORTS:
        https://bugs.freedesktop.org/enter_bug.cgi?product=systemd

AUTHOR:
        Lennart Poettering with major support from Kay Sievers

REQUIREMENTS:
        Linux kernel >= 2.6.30 (with autofs4, devtmpfs, cgroups)
        libudev >= 160
        libcgroup >= 0.35
        vala >= 0.80
        gtk+ >= 2.20
        dbus >= 1.2.24
        libcap
        PAM >= 1.1.2 (optional)