Function: pcmpl-linux--systemd-units

pcmpl-linux--systemd-units is a byte-compiled function defined in pcmpl-linux.el.gz.

Signature

(pcmpl-linux--systemd-units &rest ARGS)

Documentation

Run systemd list-units ARGS and return the output as a list.

Source Code

;; Defined in /usr/src/emacs/lisp/pcmpl-linux.el.gz
;;; systemd

(defun pcmpl-linux--systemd-units (&rest args)
  "Run `systemd list-units ARGS' and return the output as a list."
  (with-temp-buffer
    (apply #'call-process
           "systemctl" nil '(t nil) nil
           ;; "--legend=no" doesn't exist before systemd v248
           "list-units" "--full" "--no-legend" "--plain" args)
    (goto-char (point-min))
    (let (result)
      (while (re-search-forward (rx bol (group (+ (not space)))
                                    (+ space) (+ (not space))
                                    (+ space) (group (+ (not space)))
                                    (+ space) (+ (not space))
                                    (+ space) (group (* nonl)))
                                nil t)
        (push (match-string 1) result)
        (put-text-property 0 1 'pcomplete-annotation
                           (concat " " (match-string 2))
                           (car result))
        (put-text-property 0 1 'pcomplete-description
                           (match-string 3)
                           (car result)))
      (nreverse result))))