bin/doom: minor refactor; no longer default to doom refresh
Better to be explicit, otherwise you get some weird cases where incorrect commands fall through to a doom refresh.
This commit is contained in:
parent
8a7ebebf16
commit
e1e47b9173
1 changed files with 14 additions and 15 deletions
29
bin/doom
29
bin/doom
|
@ -11,7 +11,8 @@
|
||||||
(defun usage ()
|
(defun usage ()
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert (format! "%s %s [COMMAND] [ARGS...]\n"
|
(insert (format! "%s %s [COMMAND] [ARGS...]\n"
|
||||||
(bold "Usage:") (file-name-nondirectory load-file-name))
|
(bold "Usage:")
|
||||||
|
(file-name-nondirectory load-file-name))
|
||||||
"\n"
|
"\n"
|
||||||
"A command line interfacing for managing Doom Emacs; including\n"
|
"A command line interfacing for managing Doom Emacs; including\n"
|
||||||
"package management, diagnostics, unit tests, and byte-compilation.\n"
|
"package management, diagnostics, unit tests, and byte-compilation.\n"
|
||||||
|
@ -36,38 +37,36 @@
|
||||||
(doom--dispatch-help))
|
(doom--dispatch-help))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(let ((argv (cdr (cdr (cdr command-line-args))))
|
(let ((args (cdr (cdr (cdr command-line-args))))
|
||||||
(emacs-dir (expand-file-name "../" (file-name-directory load-file-name))))
|
(emacs-dir (expand-file-name "../" (file-name-directory load-file-name))))
|
||||||
;; Parse options
|
;; Parse options
|
||||||
(while (ignore-errors (string-prefix-p "-" (car argv)))
|
(while (ignore-errors (string-prefix-p "-" (car args)))
|
||||||
(pcase (pop argv)
|
(pcase (pop args)
|
||||||
((or "-d" "--debug")
|
((or "-d" "--debug")
|
||||||
(setq doom-debug-mode t))
|
(setq doom-debug-mode t))
|
||||||
((or "-p" "--private")
|
((or "-p" "--private")
|
||||||
(setq doom-private-dir (expand-file-name (pop argv)))
|
(setq doom-private-dir (expand-file-name (pop args)))
|
||||||
(or (file-directory-p doom-private-dir)
|
(or (file-directory-p doom-private-dir)
|
||||||
(error "%s does not exist" doom-private-dir)))
|
(error "%s does not exist" doom-private-dir)))
|
||||||
((or "-e" "--emacsd")
|
((or "-e" "--emacsd")
|
||||||
(setq emacs-dir (expand-file-name (pop argv)))
|
(setq emacs-dir (expand-file-name (pop args)))
|
||||||
(or (file-directory-p emacs-dir)
|
(or (file-directory-p emacs-dir)
|
||||||
(error "%s does not exist" emacs-dir)))
|
(error "%s does not exist" emacs-dir)))
|
||||||
((or "-y" "--yes")
|
((or "-y" "--yes")
|
||||||
(setq doom-auto-accept t))))
|
(setq doom-auto-accept t))))
|
||||||
|
|
||||||
;; Bootstrap Doom
|
;; Bootstrap Doom
|
||||||
|
(setq noninteractive 'doom)
|
||||||
(load (expand-file-name "init" emacs-dir)
|
(load (expand-file-name "init" emacs-dir)
|
||||||
nil 'nomessage)
|
nil 'nomessage)
|
||||||
|
|
||||||
(cond ((not noninteractive)
|
(cond ((not noninteractive)
|
||||||
;; Just incase you aren't using Doom!
|
(doom|run-all-startup-hooks))
|
||||||
(when (fboundp 'doom|run-all-startup-hooks)
|
((and (not (cdr args))
|
||||||
(doom|run-all-startup-hooks)))
|
(member (car args) '("help" "h")))
|
||||||
((and (not (cdr argv))
|
|
||||||
(member (car argv) '("help" "h")))
|
|
||||||
(usage))
|
(usage))
|
||||||
((not argv)
|
((not args)
|
||||||
(let ((default-directory user-emacs-directory))
|
(error "Expecting a command"))
|
||||||
(doom-dispatch (list "refresh"))))
|
|
||||||
((let ((default-directory user-emacs-directory))
|
((let ((default-directory user-emacs-directory))
|
||||||
(doom-dispatch argv)))))
|
(doom-dispatch args)))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue