Function: tramp-container--completion-function
tramp-container--completion-function is an autoloaded and
byte-compiled function defined in tramp-container.el.gz.
Signature
(tramp-container--completion-function PROGRAM)
Documentation
List running containers available for connection.
PROGRAM is the program to be run for "ps", either
tramp-docker-program or tramp-podman-program.
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-container--completion-function (program)
"List running containers available for connection.
PROGRAM is the program to be run for \"ps\", either
`tramp-docker-program' or `tramp-podman-program'.
This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
(when-let ((default-directory tramp-compat-temporary-file-directory)
(raw-list (shell-command-to-string
(concat program " ps --format '{{.ID}}\t{{.Names}}'")))
(lines (split-string raw-list "\n" 'omit))
(names (mapcar
(lambda (line)
(when (string-match
(rx bol (group (1+ nonl))
"\t" (? (group (1+ nonl))) eol)
line)
(or (match-string 2 line) (match-string 1 line))))
lines)))
(mapcar (lambda (name) (list nil name)) (delq nil names))))