fix(cli): doom sync: suppress rebuild prompt when upgrading

12a765c introduced suppression of package-rebuilding prompts on 'doom
upgrade', but inadvertently reversed the check. This fixes that (and
refactors the if/or tree into a `cond`).

Amend: 12a765c509
This commit is contained in:
Henrik Lissner 2024-03-27 00:23:54 -04:00
parent aef2b12100
commit 201051c368
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -74,13 +74,14 @@ OPTIONS:
(print! (warn "Your system has changed since last sync"))
(setq to-rebuild t))
(when (and to-rebuild (not (doom-cli-context-suppress-prompts-p context)))
(if nobuild?
(print! (warn "Packages need to be recompiled, but -B has prevented it. Skipping..."))
(or (not (doom-cli-context-get context 'upgrading))
(y-or-n-p
(format! " %s" "Your installed packages will need to be recompiled. Do so now?"))
(exit! 0))
(setq rebuild? t))))
(cond (nobuild?
(print! (warn "Packages must be rebuilt, but -B has prevented it. Skipping...")))
((doom-cli-context-get context 'upgrading)
(print! (warn "Packages will be rebuilt"))
(setq rebuild? t))
((y-or-n-p (format! " %s" "Installed packages must be rebuilt. Do so now?"))
(setq rebuild? t))
((exit! 0)))))
(when (and (not noenvvar?)
(file-exists-p doom-env-file))
(call! '(env)))