summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2010-11-09 01:03:27 +0200
committerLennart Poettering <lennart@poettering.net>2010-11-10 23:02:44 +0100
commit42bb3074fe9632d7aa0fee825ad30d2083c3c629 (patch)
tree9cd01cf8887590a330f7131a4cc84633a9f9a14d /Makefile.am
parentaeee2322a66d63e3071b95969a6cbd8ce8dc1053 (diff)
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
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am4
1 files changed, 4 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 69faa5581a..f2d20c7db3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,7 @@ udevrulesdir=@udevrulesdir@
pamlibdir=@pamlibdir@
pkgconfigdatadir=$(datadir)/pkgconfig
polkitpolicydir=$(datadir)/polkit-1/actions
+bashcompletiondir=${sysconfdir}/bash_completion.d
# Our own, non-special dirs
pkgsysconfdir=$(sysconfdir)/systemd
@@ -161,6 +162,9 @@ dbusinterface_DATA = \
org.freedesktop.systemd1.Swap.xml \
org.freedesktop.systemd1.Path.xml
+dist_bashcompletion_DATA = \
+ src/systemctl-bash-completion.sh
+
dist_tmpfiles_DATA = \
tmpfiles.d/systemd.conf \
tmpfiles.d/x11.conf