Function: forge--get-forge-host

forge--get-forge-host is a natively 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 /nix/store/923zwib42c4qw6x4xps0cv1wi8qcd6lp-emacs-packages-deps/share/emacs/site-lisp/elpa/forge-20261005.753/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 (##and (string-prefix-p "hostname" %)
                              (substring % 9))
                       (ignore-error file-missing
                         (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))))