chiark / gitweb /
zsh-completion: Move machine listing to autoload
[elogind.git] / shell-completion / zsh / _sd_machines
diff --git a/shell-completion/zsh/_sd_machines b/shell-completion/zsh/_sd_machines
new file mode 100644 (file)
index 0000000..1d64d13
--- /dev/null
@@ -0,0 +1,13 @@
+#autoload
+__get_machines () {
+        machinectl --full --no-pager list | {while read -r a b; do echo $a; done;};
+}
+
+local -a _machines
+_machines=("${(fo)$(__get_machines)}")
+typeset -U _machines
+if [[ -n "$_machines" ]]; then
+        _describe 'machines' _machines
+else
+        _message 'no machines'
+fi