Function: forge--get-forge-host

forge--get-forge-host is a byte-compiled function defined in forge-core.el.

Signature

(forge--get-forge-host HOST &optional DEMAND)

Documentation

Return forge-alist entry matching HOST.

Entries have the form (GITHOST APIHOST WEBHOST CLASS).

- If HOST matches a GITHOST, return the corresponding entry.
- Else, if HOST is an ssh alias and the canonical hostname matches a
  GITHOST, return the corresponding entry.
- Finally, if HOST matches a WEBHOST, return the corresponding entry.

If no entry matches, return nil, or signal an error if optional DEMAND is non-nil.

Source Code

;; Defined in ~/.emacs.d/elpa/forge-20260408.1922/forge-core.el
(defun forge--get-forge-host (host &optional demand)
  "Return `forge-alist' entry matching HOST.

Entries have the form (GITHOST APIHOST WEBHOST CLASS).

- If HOST matches a GITHOST, return the corresponding entry.
- Else, if HOST is an ssh alias and the canonical hostname matches a
  GITHOST, return the corresponding entry.
- Finally, if HOST matches a WEBHOST, return the corresponding entry.

If no entry matches, return nil, or signal an error if optional DEMAND
is non-nil."
  (or (assoc host forge-alist)
      (assoc (seq-some (lambda (line)
                         (and (string-prefix-p "hostname" line)
                              (substring line 9)))
                       (ignore-errors
                         (process-lines-ignore-status "ssh" "-G" host)))
             forge-alist)
      (car (cl-member host forge-alist :test #'equal :key #'caddr))
      (and demand
           (error "No entry for \"%s\" in `forge-alist'" host))))