summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastian Gniazdowski <sgniazdowski@gmail.com>2019-10-29 14:27:59 +0100
committerOliver Kiddle <okiddle@yahoo.co.uk>2019-10-29 15:59:02 +0100
commit2c94b597bd218c2a0b9c111fcdd1588e8611f7a9 (patch)
tree5bdb1173a4ccb4767a5fb02ac9a518cfd4929531
parent248ae0b77eaa416026ccd491d719d5ba543933a8 (diff)
downloadzsh-2c94b597bd218c2a0b9c111fcdd1588e8611f7a9.tar.gz
zsh-2c94b597bd218c2a0b9c111fcdd1588e8611f7a9.tar.xz
zsh-2c94b597bd218c2a0b9c111fcdd1588e8611f7a9.zip
github #41: Extend _dbus with dbus-launch completion
-rw-r--r--ChangeLog2
-rw-r--r--Completion/Unix/Command/_dbus24
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 21812799a..bee827d9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2019-10-29  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
+	* github #41: Sebastian: Extend _dbus with dbus-launch completion
+
 	* unposted: Completion/Unix/Command/_zfs: tweak to check for
 	openzfs rather than Solaris
 
diff --git a/Completion/Unix/Command/_dbus b/Completion/Unix/Command/_dbus
index 3f106cb5c..37b5458d7 100644
--- a/Completion/Unix/Command/_dbus
+++ b/Completion/Unix/Command/_dbus
@@ -1,4 +1,4 @@
-#compdef dbus-send dbus-monitor
+#compdef dbus-send dbus-monitor dbus-launch
 
 local curcontext="$curcontext" state line expl find end ret=1
 typeset -A opt_args
@@ -27,6 +27,20 @@ case $service in
       - '(format)' \
       --monitor --profile --pcap --binary && ret=0
   ;;
+  dbus-launch)
+    _arguments -C \
+      --version"[print the version of dbus-launch]" \
+      --help"[print the help info of dbus-launch]" \
+      --sh-syntax"[emit bourne-shell compatible code to set up environment variables]" \
+      --csh-syntax"[emit csh compatible code to set up environment variables]" \
+      --auto-syntax"[choose --csh-syntax or --sh-syntax based on the SHELL environment variable]" \
+      --binary-syntax"[use a nul-terminated syntax with the environment data]" \
+      --close-stderr"[close stderr stream before starting the d-bus daemon]" \
+      --exit-with-session"[create a persistent \"babysitter\" process]" \
+      --exit-with-x11"[create a persistent \"babysitter\" process that will connect to the x server]" \
+      --autolaunch="[scan for a previously-started session and reuse the values found there]:machine id:->machine-id" \
+      --config-file="[pass --config-file=FILENAME to the bus daemon]" && ret=0
+  ;;
 esac
 
 case $state in
@@ -85,6 +99,14 @@ case $state in
       'arg0namespace:namespace' \
       'eavesdrop:eavesdropping:(true false)' && ret=0
   ;;
+  machine-id)
+    { local machine_id="$(</var/lib/dbus/machine-id)" } 2>/dev/null
+    if [[ -n "$machine_id" ]]; then
+        _wanted machine-ids expl machine-id compadd $machine_id && ret=0
+    else
+        _message "No /var/lib/dbus/machine-id found" && ret=0
+    fi
+  ;;
 esac
 
 return ret