Improve interactive package management support

This commit is contained in:
Henrik Lissner 2018-05-16 00:10:04 +02:00
parent 595109209a
commit e7a1e0b4a2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -335,6 +335,8 @@ package.el as appropriate."
(defun doom//packages-install () (defun doom//packages-install ()
"Interactive command for installing missing packages." "Interactive command for installing missing packages."
(interactive) (interactive)
(if (not noninteractive)
(doom-packages--async-run 'doom//packages-install)
(message! "Looking for packages to install...") (message! "Looking for packages to install...")
(let ((packages (reverse (doom-get-missing-packages)))) (let ((packages (reverse (doom-get-missing-packages))))
(cond ((not packages) (cond ((not packages)
@ -381,12 +383,14 @@ package.el as appropriate."
"")))) ""))))
(message! (bold (green "Finished!"))) (message! (bold (green "Finished!")))
(doom//reload-load-path))))) (doom//reload-load-path))))))
;;;###autoload ;;;###autoload
(defun doom//packages-update () (defun doom//packages-update ()
"Interactive command for updating packages." "Interactive command for updating packages."
(interactive) (interactive)
(if (not noninteractive)
(doom-packages--async-run 'doom//packages-update)
(message! "Looking for outdated packages...") (message! "Looking for outdated packages...")
(doom-refresh-packages-maybe doom-debug-mode) (doom-refresh-packages-maybe doom-debug-mode)
(let ((packages (sort (doom-get-outdated-packages) #'doom--sort-alpha))) (let ((packages (sort (doom-get-outdated-packages) #'doom--sort-alpha)))
@ -421,12 +425,14 @@ package.el as appropriate."
(if result "✓ DONE" "✕ FAILED")))))) (if result "✓ DONE" "✕ FAILED"))))))
(message! (bold (green "Finished!"))) (message! (bold (green "Finished!")))
(doom//reload-load-path))))) (doom//reload-load-path))))))
;;;###autoload ;;;###autoload
(defun doom//packages-autoremove () (defun doom//packages-autoremove ()
"Interactive command for auto-removing orphaned packages." "Interactive command for auto-removing orphaned packages."
(interactive) (interactive)
(if (not noninteractive)
(doom-packages--async-run 'doom//packages-autoremove)
(message! "Looking for orphaned packages...") (message! "Looking for orphaned packages...")
(let ((packages (doom-get-orphaned-packages))) (let ((packages (doom-get-orphaned-packages)))
(cond ((not packages) (cond ((not packages)
@ -462,7 +468,7 @@ package.el as appropriate."
pkg))))) pkg)))))
(message! (bold (green "Finished!"))) (message! (bold (green "Finished!")))
(doom//reload-load-path))))) (doom//reload-load-path))))))
;; ;;