Function: tramp-distrobox--completion-function

tramp-distrobox--completion-function is an autoloaded and byte-compiled function defined in tramp-container.el.gz.

Signature

(tramp-distrobox--completion-function METHOD)

Documentation

List Distrobox containers available for connection.

This function is used by tramp-set-completion-function, please see its function help for a description of the format.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-container.el.gz
;;;###tramp-autoload
(defun tramp-distrobox--completion-function (method)
  "List Distrobox containers available for connection.

This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
  (tramp-skeleton-completion-function method
    (when-let* ((raw-list (shell-command-to-string (concat program " list")))
		;; Ignore header line.
		(lines (cdr (split-string raw-list "\n" 'omit)))
		;; We do not show container IDs.
		(names (tramp-compat-seq-keep
			(lambda (line)
			  (when (string-match
				 (rx bol (1+ (not space))
				     (1+ space) "|" (1+ space)
				     (group (1+ (not space))) space)
				 line)
			    (match-string 1 line)))
			lines)))
      (mapcar (lambda (name) (list nil name)) names))))