Add doom-cli-post-{failure,success}-execute-hook vars

To replace doom-cli-post-execute-hook. Now only displays "refresh"
message after a successful command.
This commit is contained in:
Henrik Lissner 2019-07-25 17:23:39 +02:00
parent bdcb156b91
commit d00c5a0de5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -10,7 +10,7 @@ commands like `doom-packages-install', `doom-packages-update' and
(defvar doom-cli-pre-execute-hook nil (defvar doom-cli-pre-execute-hook nil
"TODO") "TODO")
(defvar doom-cli-post-execute-hook nil (defvar doom-cli-post-success-execute-hook nil
"TODO") "TODO")
(defvar doom--cli-commands (make-hash-table :test 'equal)) (defvar doom--cli-commands (make-hash-table :test 'equal))
@ -98,15 +98,17 @@ If SHOW-HELP is non-nil, show the documentation for said dispatcher."
(doom--dispatch-help fn args) (doom--dispatch-help fn args)
(let ((start-time (current-time))) (let ((start-time (current-time)))
(run-hooks 'doom-cli-pre-execute-hook) (run-hooks 'doom-cli-pre-execute-hook)
(when-let (ret (apply fn args)) (unwind-protect
(print! (when-let (ret (apply fn args))
"\n%s" (print!
(success "Finished! (%.4fs)" "\n%s"
(float-time (success "Finished! (%.4fs)"
(time-subtract (current-time) (float-time
start-time)))) (time-subtract (current-time)
(run-hooks 'doom-cli-post-execute-hook) start-time))))
ret))))) (run-hooks 'doom-cli-post-execute-hook)
ret)
(run-hooks 'doom-cli-post-error-execute-hook))))))
(defmacro def-command-group! (name docstring &rest body) (defmacro def-command-group! (name docstring &rest body)
"TODO" "TODO"