feat(cli): implement second argument of doom-cli-find

It was intended to be a flag to suppress this function from including
partial CLIs in the returned list, but wasn't actually implemented until
now.
This commit is contained in:
Henrik Lissner 2022-09-15 19:14:09 +02:00
parent d552dbc878
commit 85fac73d37
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -370,8 +370,8 @@ If NOLOAD? is non-nil, don't autoload deferred CLIs (see `doom-cli-get')."
(push cli paths))) (push cli paths)))
(nreverse paths))))) (nreverse paths)))))
(defun doom-cli-find (command &optional norecursive) (defun doom-cli-find (command &optional nopartials?)
"Find all CLIs assocated with COMMAND, excluding partials if NORECURSIVE. "Find all CLIs assocated with COMMAND, including partials.
COMMAND can be a command path (list of strings), a `doom-cli' struct, or a COMMAND can be a command path (list of strings), a `doom-cli' struct, or a
`doom-cli-context' struct. `doom-cli-context' struct.
@ -388,7 +388,9 @@ Returned in the order they will execute. Includes pseudo CLIs."
(push (cons :before path) results)) (push (cons :before path) results))
(push '(:before) results) (push '(:before) results)
(dolist (result results (nreverse clis)) (dolist (result results (nreverse clis))
(when-let (cli (doom-cli-get result t)) (when-let ((cli (doom-cli-get result t))
((or (not nopartials?)
(doom-cli-type cli))))
(cl-pushnew cli clis (cl-pushnew cli clis
:test #'equal :test #'equal
:key #'doom-cli-key))))) :key #'doom-cli-key)))))