Generalize doom-sh

And slightly reformat 'doom upgrade' "you have updates" message.
This commit is contained in:
Henrik Lissner 2019-07-29 20:57:20 +02:00
parent c67c503392
commit c32244ad4e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 24 additions and 21 deletions

View file

@ -31,6 +31,18 @@ commands like `doom-packages-install', `doom-packages-update' and
(eval (sexp-at-point) t))
t)))
(defun doom-sh (command &rest args)
"Execute COMMAND with ARGS in the shell and return (STATUS . OUTPUT).
STATUS is a boolean"
(let ((output (get-buffer-create "*doom-sh-output*")))
(unwind-protect
(cons (or (apply #'call-process command nil output nil args)
-1)
(with-current-buffer output
(string-trim (buffer-string))))
(kill-buffer output))))
(defun doom--dispatch-command (command)
(when (symbolp command)
(setq command (symbol-name command)))