refactor(lib): convert cli/autoloads.el to lib
This commit is contained in:
parent
7ea4b21953
commit
b804a2f34f
3 changed files with 59 additions and 58 deletions
108
bin/doom
108
bin/doom
|
@ -245,70 +245,66 @@ SEE ALSO:
|
||||||
|
|
||||||
;; There are a lot of CLIs, and some have expensive initialization, so best we
|
;; There are a lot of CLIs, and some have expensive initialization, so best we
|
||||||
;; load them lazily.
|
;; load them lazily.
|
||||||
(let ((dir (doom-path doom-core-dir "cli")))
|
(defcli-group!
|
||||||
;; Library for generating autoloads files for Doom modules & packages.
|
:prefix 'doom
|
||||||
(load! "autoloads" dir)
|
;; Import this for implicit 'X help' commands for your script:
|
||||||
|
(defcli-alias! ((help h)) (:root :help))
|
||||||
|
;; And suggest its use when errors occur.
|
||||||
|
(add-to-list 'doom-help-commands "%p h[elp] %c")
|
||||||
|
|
||||||
(defcli-group!
|
(defcli-group! "Config Management"
|
||||||
:prefix 'doom
|
:docs "Commands for maintaining your Doom Emacs configuration."
|
||||||
;; Import this for implicit 'X help' commands for your script:
|
(defcli-autoload! ((sync s)))
|
||||||
(defcli-alias! ((help h)) (:root :help))
|
(defcli-autoload! ((profiles profile)))
|
||||||
;; And suggest its use when errors occur.
|
(defcli-autoload! ((upgrade up)))
|
||||||
(add-to-list 'doom-help-commands "%p h[elp] %c")
|
(defcli-autoload! (env))
|
||||||
|
(defcli-autoload! ((build b purge p rollback)) "packages")
|
||||||
|
(defcli-autoload! ((install i)))
|
||||||
|
(defcli-autoload! ((compile c)))
|
||||||
|
(defcli-autoload! (clean) "compile")
|
||||||
|
|
||||||
(defcli-group! "Config Management"
|
;; TODO Post-3.0 commands
|
||||||
:docs "Commands for maintaining your Doom Emacs configuration."
|
;; (load! "gc" dir)
|
||||||
(defcli-autoload! ((sync s)))
|
;; (load! "module" dir)
|
||||||
(defcli-autoload! ((profiles profile)))
|
;; (load! "nuke" dir)
|
||||||
(defcli-autoload! ((upgrade up)))
|
;; (load! "package" dir)
|
||||||
(defcli-autoload! (env))
|
;; (load! "profile" dir)
|
||||||
(defcli-autoload! ((build b purge p rollback)) "packages")
|
;; (defcli-obsolete! ((compile c)) (sync "--compile") "v3.0.0")
|
||||||
(defcli-autoload! ((install i)))
|
;; (defcli-obsolete! ((build b)) (sync "--rebuild") "v3.0.0")
|
||||||
(defcli-autoload! ((compile c)))
|
)
|
||||||
(defcli-autoload! (clean) "compile")
|
|
||||||
|
|
||||||
;; TODO Post-3.0 commands
|
(defcli-group! "Diagnostics"
|
||||||
;; (load! "gc" dir)
|
:docs "Commands for troubleshooting and debugging Doom."
|
||||||
;; (load! "module" dir)
|
(defcli-autoload! ((doctor doc)))
|
||||||
;; (load! "nuke" dir)
|
(defcli-autoload! (info))
|
||||||
;; (load! "package" dir)
|
(defcli-alias! ((version v)) (:root :version)))
|
||||||
;; (load! "profile" dir)
|
|
||||||
;; (defcli-obsolete! ((compile c)) (sync "--compile") "v3.0.0")
|
|
||||||
;; (defcli-obsolete! ((build b)) (sync "--rebuild") "v3.0.0")
|
|
||||||
)
|
|
||||||
|
|
||||||
(defcli-group! "Diagnostics"
|
(defcli-group! "Development"
|
||||||
:docs "Commands for troubleshooting and debugging Doom."
|
:docs "Commands for developing or launching Doom."
|
||||||
(defcli-autoload! ((doctor doc)))
|
(defcli-autoload! (ci))
|
||||||
(defcli-autoload! (info))
|
(defcli-autoload! (make))
|
||||||
(defcli-alias! ((version v)) (:root :version)))
|
(defcli-autoload! (run))
|
||||||
|
|
||||||
(defcli-group! "Development"
|
;; FIXME Test framework
|
||||||
:docs "Commands for developing or launching Doom."
|
;; (load! "test" dir)
|
||||||
(defcli-autoload! (ci))
|
)
|
||||||
(defcli-autoload! (make))
|
|
||||||
(defcli-autoload! (run))
|
|
||||||
|
|
||||||
;; FIXME Test framework
|
(let ((cli-file "cli"))
|
||||||
;; (load! "test" dir)
|
(defcli-group! "Module commands"
|
||||||
)
|
(dolist (key (doom-module-list))
|
||||||
|
(when-let (path (doom-module-expand-path (car key) (cdr key) cli-file))
|
||||||
|
(defcli-group! :prefix (format "+%s" (cdr key))
|
||||||
|
(doom-load path t)))))
|
||||||
|
|
||||||
(let ((cli-file "cli"))
|
(load! cli-file doom-user-dir t))
|
||||||
(defcli-group! "Module commands"
|
|
||||||
(dolist (key (doom-module-list))
|
|
||||||
(when-let (path (doom-module-expand-path (car key) (cdr key) cli-file))
|
|
||||||
(defcli-group! :prefix (format "+%s" (cdr key))
|
|
||||||
(doom-load path t)))))
|
|
||||||
|
|
||||||
(load! cli-file doom-user-dir t))
|
;; Allow per-project Doom settings in .doom files.
|
||||||
|
(let (doomrc)
|
||||||
;; Allow per-project Doom settings in .doom files.
|
(cond
|
||||||
(let (doomrc)
|
((setq doomrc (getenv "DOOMRC"))
|
||||||
(cond
|
(load! doomrc))
|
||||||
((setq doomrc (getenv "DOOMRC"))
|
((setq doomrc (locate-dominating-file default-directory ".doomrc"))
|
||||||
(load! doomrc))
|
(load! ".doomrc" doomrc)))))
|
||||||
((setq doomrc (locate-dominating-file default-directory ".doomrc"))
|
|
||||||
(load! ".doomrc" doomrc))))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
(doom-require 'doom-lib 'plist)
|
(doom-require 'doom-lib 'plist)
|
||||||
(doom-require 'doom-lib 'files)
|
(doom-require 'doom-lib 'files)
|
||||||
(doom-require 'doom-lib 'print)
|
(doom-require 'doom-lib 'print)
|
||||||
;; (doom-require 'doom-lib 'autoloads)
|
(doom-require 'doom-lib 'autoloads)
|
||||||
|
|
||||||
;; Ensure straight and core packages are ready to go for CLI commands.
|
;; Ensure straight and core packages are ready to go for CLI commands.
|
||||||
(require 'doom-modules)
|
(require 'doom-modules)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
;;; lisp/cli/autoloads.el -*- lexical-binding: t; -*-
|
;;; lisp/lib/autoloads.el -*- lexical-binding: t; -*-
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
(defvar doom-autoloads-excluded-packages ()
|
(defvar doom-autoloads-excluded-packages ()
|
||||||
"Which packages to exclude from Doom's autoloads files.
|
"Which packages to exclude from Doom's autoloads files.
|
||||||
|
@ -192,3 +194,6 @@ non-nil, treat FILES as pre-generated autoload files instead."
|
||||||
(not literal))
|
(not literal))
|
||||||
autoloads))
|
autoloads))
|
||||||
(end-of-file))))))))
|
(end-of-file))))))))
|
||||||
|
|
||||||
|
(provide 'doom-lib '(autoloads))
|
||||||
|
;;; autoloads.el end here
|
Loading…
Add table
Add a link
Reference in a new issue