Rewrite interactive CLI commands
- Replace doom//upgrade with doom/upgrade - Replace doom//autoloads with doom/reload-autoloads - Replace doom//refresh with doom/reload - Remove doom//install; there should be no workflow for this command - Remove doom//autoremove; autoremove was replaced with purge. Maybe I'll write a doom//purge analogue. Not sure yet. - Use compile instead of hacky wrapper around core-cli API Rewrite interactive CLI commands - Rewrite doom//upgrade & doom//autoloads - Remove doom//install; there really should be no use-case for it - Remove doom//autoremove; autoremove was replaced with purge. I'll get around to writing a doom//purge eventually. fixup! Rewrite interactive CLI commands
This commit is contained in:
parent
0f9e60d62c
commit
1e6ef4d6e4
3 changed files with 57 additions and 111 deletions
|
@ -1,86 +1,5 @@
|
|||
;;; core/autoload/cli.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Externs
|
||||
(defvar evil-collection-mode-list)
|
||||
|
||||
;;;###autoload
|
||||
(defun doom--cli-run (command &rest _args)
|
||||
(require 'core-cli)
|
||||
(require 'core-packages)
|
||||
(require 'straight)
|
||||
(when (featurep 'general)
|
||||
(general-auto-unbind-keys))
|
||||
(let* ((evil-collection-mode-list nil)
|
||||
(default-directory doom-emacs-dir)
|
||||
(buf (get-buffer-create " *bin/doom*"))
|
||||
(doom-format-backend 'ansi)
|
||||
(ignore-window-parameters t)
|
||||
(noninteractive t)
|
||||
(standard-output
|
||||
(lambda (char)
|
||||
(with-current-buffer buf
|
||||
(insert char)
|
||||
(when (memq char '(?\n ?\r))
|
||||
(ansi-color-apply-on-region (line-beginning-position -1) (line-end-position))
|
||||
(redisplay))))))
|
||||
(setq doom-modules (doom-modules))
|
||||
(with-current-buffer (switch-to-buffer buf)
|
||||
(erase-buffer)
|
||||
(require 'package)
|
||||
(redisplay)
|
||||
(doom-cli-execute command nil)
|
||||
(print! (green "\nDone!"))))
|
||||
(when (featurep 'general)
|
||||
(general-auto-unbind-keys 'undo))
|
||||
(message (format! (green "Done!"))))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//autoloads (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "autoloads")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//update (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "update")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//upgrade (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "upgrade"))
|
||||
(when (y-or-n-p "You must restart Emacs for the upgrade to take effect. Restart?")
|
||||
(doom/restart-and-restore)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//install (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "install")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//autoremove (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "autoremove")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom//refresh (&optional yes)
|
||||
"TODO"
|
||||
(interactive "P")
|
||||
(let ((doom-auto-accept yes))
|
||||
(doom--cli-run "refresh")))
|
||||
|
||||
|
||||
|
||||
;;
|
||||
;;; Library
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue