Function: tramp-flatpak--completion-function

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

Signature

(tramp-flatpak--completion-function METHOD)

Documentation

List Flatpak sandboxes available for connection.

It returns application IDs or, in case there is no application ID, instance IDs.

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-flatpak--completion-function (method)
  "List Flatpak sandboxes available for connection.
It returns application IDs or, in case there is no application
ID, instance IDs.

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
		  ;; Ignore header line.
		  (concat program " ps --columns=instance,application | cat -")))
		(lines (split-string raw-list "\n" 'omit))
		(names (tramp-compat-seq-keep
			(lambda (line)
			  (when (string-match
				 (rx bol (* space) (group (+ (not space)))
				     (? (+ space) (group (+ (not space)))) eol)
				 line)
			    (or (match-string 2 line) (match-string 1 line))))
			lines)))
      (mapcar (lambda (name) (list nil name)) names))))