feat(cli): add -j/--jobs NUM options

To 'doom sync', 'doom upgrade', and 'doom build'. So users can decide
whether they want Doom 100%'ing their CPUs.

After 3.0, many of these commands will be merged, so a little code
duplication is fine for now.
This commit is contained in:
Henrik Lissner 2022-06-19 01:29:40 +02:00
parent 89e02c1c2b
commit 498d88ba9b
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 19 additions and 5 deletions

View file

@ -20,6 +20,7 @@
(defcli! ((upgrade up))
((packages? ("-p" "--packages") "Only upgrade packages, not Doom")
(jobs ("-j" "--jobs" num) "How many CPUs to use for native compilation")
&context context)
"Updates Doom and packages.
@ -31,7 +32,7 @@ following shell commands:
doom clean
doom sync -u"
(let* ((force? (doom-cli-context-suppress-prompts-p context))
(sync-cmd '("sync" "-u")))
(sync-cmd (append '("sync" "-u") (if jobs `("-j" ,num)))))
(cond
(packages?
(call! sync-cmd)
@ -41,7 +42,9 @@ following shell commands:
;; Reload Doom's CLI & libraries, in case there were any upstream changes.
;; Major changes will still break, however
(print! (item "Reloading Doom Emacs"))
(exit! "doom" "upgrade" "-p" (if force? "--force")))
(exit! "doom" "upgrade" "-p"
(if force? "--force")
(if jobs (format "--jobs=%d" jobs))))
((print! "Doom is up-to-date!")
(call! sync-cmd)))))