core-cli: backport more refactors from rewrite

Still a long way to go, but this introduces a few niceties for
debugging CLI failures:

+ The (extended) output of the last bin/doom command is now logged to
  ~/.emacs.d/.local/doom.log
+ If an error occurs, short backtraces are displayed whether or not you
  have debug mode on. The full backtrace is written to
  ~/.emacs.d/.local/doom.error.log.
+ bin/doom now aborts with a warning if:
  - The script itself or its parent directory is a symlink. It's fine if
    ~/.emacs.d is symlinked though.
  - Running bin/doom as root when your DOOMDIR isn't in /root/.
  - If you're sporting Emacs 26.1 (now handled in the elisp side rather
    than the /bin/sh shebang preamble).
+ If a 'doom sync' was aborted prematurely, you'll be warned that Doom
  was left in an inconsistent state and that you must run `doom sync`
  again.

May address #3746
This commit is contained in:
Henrik Lissner 2020-08-24 00:36:52 -04:00
parent 7e362e8fbd
commit e632871a11
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
11 changed files with 393 additions and 242 deletions

View file

@ -24,7 +24,7 @@ following shell commands:
;; Reload Doom's CLI & libraries, in case there were any upstream changes.
;; Major changes will still break, however
(print! (info "Reloading Doom Emacs"))
(doom-cli-execute-after "doom" "upgrade" "-p" (if force-p "-f")))
(throw 'exit (list "doom" "upgrade" "-p" (if force-p "-f"))))
((print! "Doom is up-to-date!")))))