fix(cli): ci.el loader

- :before ci will try to load $REPOROOT/ci.el or $DOOMDIR/ci.el. It
  finds $REPOROOT by calling `git`, but doesn't handle errors. Now it
  does.
- Because &rest was in :before ci's argspec, :before ci * subcommands
  would be inaccessible (not that any exist atm, though).
- Let the user know when it finds the project's ci.el.
This commit is contained in:
Henrik Lissner 2022-06-19 22:13:20 +02:00
parent 7862a9e15d
commit 50a0c2ef46
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -247,15 +247,18 @@ Note: warnings are not considered failures.")
;;; Commands
;;; doom ci
(defcli! (:before ci) (&rest _)
(defcli! (:before ci) (&args _)
(when-let*
((repo-root (or (cdr (doom-call-process "git" "rev-parse" "--show-toplevel"))
default-directory))
((repo-root
(if-let* ((result (sh! "git" "rev-parse" "--show-toplevel"))
((zerop (car result))))
(cdr result)
default-directory))
(local-config
(car (or (doom-glob repo-root "ci.el")
(doom-glob doom-private-dir "ci.el")))))
(print! (item "Loading %s") (path local-config))
(load local-config nil t t)))
(load local-config nil t t)
(print! (item "Loaded %S") local-config)))
(defcli! ci ()
"Commands that automate development processes."