feat(cli): add --benchmark switch
This commit is contained in:
parent
4009509db5
commit
aef14f078d
2 changed files with 6 additions and 1 deletions
3
bin/doom
3
bin/doom
|
@ -172,6 +172,7 @@ SEE ALSO:
|
||||||
(emacsdir ("--emacsdir" dir) "Use Doom install living in `DIR' (e.g. ~/.emacs.d)")
|
(emacsdir ("--emacsdir" dir) "Use Doom install living in `DIR' (e.g. ~/.emacs.d)")
|
||||||
(pager ("--pager" cmd) "Pager command to use for large output")
|
(pager ("--pager" cmd) "Pager command to use for large output")
|
||||||
(profile ("--profile" name) "Use profile named NAME")
|
(profile ("--profile" name) "Use profile named NAME")
|
||||||
|
(bench? ("--benchmark") "Always display the benchmark")
|
||||||
&flags
|
&flags
|
||||||
(color? ("--color") "Whether or not to show ANSI color codes")
|
(color? ("--color") "Whether or not to show ANSI color codes")
|
||||||
&multiple
|
&multiple
|
||||||
|
@ -191,6 +192,8 @@ SEE ALSO:
|
||||||
Warning: files loaded this way load too late to define new commands. To
|
Warning: files loaded this way load too late to define new commands. To
|
||||||
define commands, do so from `$DOOMDIR'/cli.el, `$DOOMDIR'/init.el, or a
|
define commands, do so from `$DOOMDIR'/cli.el, `$DOOMDIR'/init.el, or a
|
||||||
.doomrc file in the current project tree."
|
.doomrc file in the current project tree."
|
||||||
|
(when bench?
|
||||||
|
(setq doom-cli-benchmark-threshold 'always))
|
||||||
(when color?
|
(when color?
|
||||||
(setq doom-print-backend (if (eq color? :yes) 'ansi)))
|
(setq doom-print-backend (if (eq color? :yes) 'ansi)))
|
||||||
(when pager
|
(when pager
|
||||||
|
|
|
@ -179,7 +179,8 @@ Must have two arguments, one for session id and the other for log type.")
|
||||||
"How much execution time (in seconds) before benchmark is shown.
|
"How much execution time (in seconds) before benchmark is shown.
|
||||||
|
|
||||||
If set to nil, only display benchmark if a CLI explicitly requested with a
|
If set to nil, only display benchmark if a CLI explicitly requested with a
|
||||||
non-nil :benchmark property.")
|
non-nil :benchmark property.
|
||||||
|
If set to `always', show the benchmark no matter what.")
|
||||||
|
|
||||||
(defvar doom-cli--context nil)
|
(defvar doom-cli--context nil)
|
||||||
(defvar doom-cli--exit-code 255)
|
(defvar doom-cli--exit-code 255)
|
||||||
|
@ -1065,6 +1066,7 @@ shown."
|
||||||
(standard-output (doom-rpartial #'doom-cli--output context)))
|
(standard-output (doom-rpartial #'doom-cli--output context)))
|
||||||
(when (and (/= doom-cli--exit-code 254)
|
(when (and (/= doom-cli--exit-code 254)
|
||||||
(or (eq (doom-cli-prop cli :benchmark) t)
|
(or (eq (doom-cli-prop cli :benchmark) t)
|
||||||
|
(eq doom-cli-benchmark-threshold 'always)
|
||||||
(and (eq (doom-cli-prop cli :benchmark :null) :null)
|
(and (eq (doom-cli-prop cli :benchmark :null) :null)
|
||||||
(not (doom-cli-context-pipe-p context 'out t))
|
(not (doom-cli-context-pipe-p context 'out t))
|
||||||
(> duration (or doom-cli-benchmark-threshold
|
(> duration (or doom-cli-benchmark-threshold
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue