Function: ghostel--tramp-shell-spec

ghostel--tramp-shell-spec is a natively compiled function defined in ghostel-shell.el.

Signature

(ghostel--tramp-shell-spec METHOD)

Documentation

Return (PROGRAM . EXTRA-ARGS) for TRAMP METHOD from ghostel-tramp-shells.

METHOD is a TRAMP method string or t for the default. PROGRAM is the shell path: either the configured string or, for the login-shell symbol, the remote user's login shell auto-detected via getent passwd (falling back to the entry's FALLBACK). EXTRA-ARGS are the optional arguments listed after the FALLBACK slot. Returns nil when no program resolves for METHOD.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-shell.el
(defun ghostel--tramp-shell-spec (method)
  "Return (PROGRAM . EXTRA-ARGS) for TRAMP METHOD from `ghostel-tramp-shells'.
METHOD is a TRAMP method string or t for the default.
PROGRAM is the shell path: either the configured string or, for the
`login-shell' symbol, the remote user's login shell auto-detected
via `getent passwd' \(falling back to the entry's FALLBACK).
EXTRA-ARGS are the optional arguments listed after the FALLBACK slot.
Returns nil when no program resolves for METHOD."
  (let* ((specs (cdr (assoc method ghostel-tramp-shells)))
         (first (car specs))
         (second (cadr specs))
         (args (cddr specs))
         (program
          (if (eq first 'login-shell)
              (let* ((entry (ignore-errors
                              (with-output-to-string
                                (with-current-buffer standard-output
                                  (unless (= 0 (process-file-shell-command
                                                "getent passwd $LOGNAME"
                                                nil (current-buffer) nil))
                                    (error "Unexpected return value"))
                                  (when (> (count-lines (point-min) (point-max)) 1)
                                    (error "Unexpected output"))))))
                     (shell (when entry
                              (nth 6 (split-string entry ":" nil "[ \t\n\r]+")))))
                (or shell second))
            first)))
    (and program (cons program args))))