refactor(cli,lib): print levels & output redirection
This refactors how Doom captures and redirects its output (to stdout and stderr) into a more general with-output-to! macro, and: - Simplifies the "print level" system. The various doom-print-*-level variables have been removed. - Adds a new print level: notice, which will be the default level for all standard output (from print!, doom-print, prin[ct1], etc). - Adds a with-output-to! macro for capturing and redirecting output to multiple streams (without suppressing it from stdout). It can also be nested. - Changes the following about doom-print: - Default :format changed to nil (was t) - Default :level changed to t (was `doom-print-level`) - No longer no-ops if OUTPUT is only whitespace
This commit is contained in:
parent
6cac7b05b6
commit
b7bd27d22b
4 changed files with 226 additions and 170 deletions
6
bin/doom
6
bin/doom
|
@ -169,7 +169,8 @@ SEE ALSO:
|
|||
|
||||
(defcli! :before
|
||||
((force? ("-!" "--force") "Suppress prompts by auto-accepting their consequences")
|
||||
(debug? ("-D" "--debug") "Enable verbose output")
|
||||
(debug? ("-D" "--debug") "Enable debug output")
|
||||
(verbose? ("-v" "--verbose") "Enable verbose output")
|
||||
(doomdir ("--doomdir" dir) "Use Doom config living in `DIR' (e.g. ~/.doom.d)")
|
||||
(emacsdir ("--emacsdir" dir) "Use Doom install living in `DIR' (e.g. ~/.emacs.d)")
|
||||
(pager ("--pager" cmd) "Pager command to use for large output")
|
||||
|
@ -196,6 +197,9 @@ SEE ALSO:
|
|||
.doomrc file in the current project tree."
|
||||
(when bench?
|
||||
(setq doom-cli-benchmark-threshold 'always))
|
||||
(unless init-file-debug ; debug-mode implies verbose
|
||||
(when verbose?
|
||||
(setq doom-print-minimum-level 'info)))
|
||||
(when color?
|
||||
(setq doom-print-backend (if (eq color? :yes) 'ansi)))
|
||||
(when pager
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue