def-command! -> defcli!

And def-command-group! -> defcligroup!, to match our new convention for
naming definer macros.
This commit is contained in:
Henrik Lissner 2019-07-28 01:32:16 +02:00
parent 0a05fd09c3
commit 4dc42de9e3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
10 changed files with 25 additions and 25 deletions

View file

@ -17,7 +17,7 @@ one wants that.")
;; ;;
;;; Commands ;;; Commands
(def-command! (autoloads a) () (defcli! (autoloads a) ()
"Regenerates Doom's autoloads files. "Regenerates Doom's autoloads files.
It scans and reads autoload cookies (;;;###autoload) in core/autoload/*.el, It scans and reads autoload cookies (;;;###autoload) in core/autoload/*.el,

View file

@ -1,6 +1,6 @@
;;; core/cli/byte-compile.el -*- lexical-binding: t; -*- ;;; core/cli/byte-compile.el -*- lexical-binding: t; -*-
(def-command! (compile c) (&rest targets) (defcli! (compile c) (&rest targets)
"Byte-compiles your config or selected modules. "Byte-compiles your config or selected modules.
compile [TARGETS...] compile [TARGETS...]
@ -12,11 +12,11 @@ and your private config files, respectively. To recompile your packages, use
'doom rebuild' instead." 'doom rebuild' instead."
(doom-byte-compile targets)) (doom-byte-compile targets))
(def-command! (recompile rc) (&rest targets) (defcli! (recompile rc) (&rest targets)
"Re-byte-compiles outdated *.elc files." "Re-byte-compiles outdated *.elc files."
(doom-byte-compile targets 'recompile)) (doom-byte-compile targets 'recompile))
(def-command! clean () (defcli! clean ()
"Delete all *.elc files." "Delete all *.elc files."
(doom-clean-byte-compiled-files)) (doom-clean-byte-compiled-files))

View file

@ -6,7 +6,7 @@
;; ;;
;;; Commands ;;; Commands
(def-command! info (&optional format) (defcli! info (&optional format)
"Output system info in markdown for bug reports. "Output system info in markdown for bug reports.
Will print in the following formats: Will print in the following formats:
@ -32,7 +32,7 @@ If no arguments are given, --raw is assumed."
format))) format)))
nil) nil)
(def-command! (version v) () (defcli! (version v) ()
"Reports the version of Doom and Emacs." "Reports the version of Doom and Emacs."
(doom/version) (doom/version)
nil) nil)

View file

@ -1,6 +1,6 @@
;;; core/cli/env.el -*- lexical-binding: t; -*- ;;; core/cli/env.el -*- lexical-binding: t; -*-
(def-command! env (&rest args) (defcli! env (&rest args)
"Regenerates your envvars file. "Regenerates your envvars file.
doom env [-c|--clear] doom env [-c|--clear]

View file

@ -1,13 +1,13 @@
;;; core/cli/install.el -*- lexical-binding: t; -*- ;;; core/cli/install.el -*- lexical-binding: t; -*-
(def-command! quickstart (&rest args) ; DEPRECATED (defcli! quickstart (&rest args) ; DEPRECATED
"This is a deprecated alias for 'doom install'. "This is a deprecated alias for 'doom install'.
See 'doom help install' instead." See 'doom help install' instead."
:hidden t :hidden t
(apply #'doom-cli-install args)) (apply #'doom-cli-install args))
(def-command! (install i) (&rest args) (defcli! (install i) (&rest args)
"A wizard for installing Doom for the first time. "A wizard for installing Doom for the first time.
This command does the following: This command does the following:

View file

@ -12,7 +12,7 @@
;; ;;
;;; Dispatchers ;;; Dispatchers
(def-command! (update u) () (defcli! (update u) ()
"Updates packages. "Updates packages.
This excludes packages whose `package!' declaration contains a non-nil :freeze This excludes packages whose `package!' declaration contains a non-nil :freeze
@ -21,7 +21,7 @@ or :ignore property."
(straight-check-all) (straight-check-all)
(doom-packages-update doom-auto-accept))) (doom-packages-update doom-auto-accept)))
(def-command! (rebuild b) (&rest args) (defcli! (rebuild b) (&rest args)
"Rebuilds all installed packages. "Rebuilds all installed packages.
This ensures that all needed files are symlinked from their package repo and This ensures that all needed files are symlinked from their package repo and
@ -29,7 +29,7 @@ their elisp files are byte-compiled."
(doom--ensure-autoloads-while (doom--ensure-autoloads-while
(doom-packages-rebuild doom-auto-accept (member "-f" args)))) (doom-packages-rebuild doom-auto-accept (member "-f" args))))
(def-command! (purge p) (&rest args) (defcli! (purge p) (&rest args)
"Deletes any unused packages and repos." "Deletes any unused packages and repos."
(doom--ensure-autoloads-while (doom--ensure-autoloads-while
(straight-check-all) (straight-check-all)
@ -37,7 +37,7 @@ their elisp files are byte-compiled."
(member "-f" args) (member "-f" args)
doom-auto-accept))) doom-auto-accept)))
;; (def-command! rollback () ; TODO rollback ;; (defcli! rollback () ; TODO rollback
;; "<Not implemented yet>" ;; "<Not implemented yet>"
;; (user-error "Not implemented yet, sorry!")) ;; (user-error "Not implemented yet, sorry!"))

View file

@ -1,6 +1,6 @@
;;; core/cli/patch-macos.el -*- lexical-binding: t; -*- ;;; core/cli/patch-macos.el -*- lexical-binding: t; -*-
(def-command! patch-macos () ; DEPRECATED (defcli! patch-macos () ; DEPRECATED
"Patches Emacs.app to respect your shell environment. "Patches Emacs.app to respect your shell environment.
WARNING: This command is deprecated. Use 'doom env' instead. WARNING: This command is deprecated. Use 'doom env' instead.

View file

@ -1,6 +1,6 @@
;;; core/cli/test.el -*- lexical-binding: t; -*- ;;; core/cli/test.el -*- lexical-binding: t; -*-
(def-command! test () (defcli! test ()
"Run Doom unit tests.") "Run Doom unit tests.")

View file

@ -1,6 +1,6 @@
;;; core/cli/upgrade.el -*- lexical-binding: t; -*- ;;; core/cli/upgrade.el -*- lexical-binding: t; -*-
(def-command! (upgrade up) () (defcli! (upgrade up) ()
"Updates Doom and packages. "Updates Doom and packages.
This requires that ~/.emacs.d is a git repo, and is the equivalent of the This requires that ~/.emacs.d is a git repo, and is the equivalent of the

View file

@ -114,14 +114,14 @@ If SHOW-HELP is non-nil, show the documentation for said dispatcher."
(user-error "I don't understand 'doom %s %s'\n\nRun 'doom help' to see what I do understand." cmd (string-join args " ")))) (user-error "I don't understand 'doom %s %s'\n\nRun 'doom help' to see what I do understand." cmd (string-join args " "))))
(run-hooks 'doom-cli-post-error-execute-hook)))))) (run-hooks 'doom-cli-post-error-execute-hook))))))
(defmacro def-command-group! (name docstring &rest body) (defmacro defcligroup! (name docstring &rest body)
"TODO" "TODO"
(declare (indent defun) (doc-string 2)) (declare (indent defun) (doc-string 2))
`(let ((doom--cli-group ,name)) `(let ((doom--cli-group ,name))
(puthash doom--cli-group ,docstring doom--cli-groups) (puthash doom--cli-group ,docstring doom--cli-groups)
,@body)) ,@body))
(defmacro def-command! (names arglist docstring &rest body) (defmacro defcli! (names arglist docstring &rest body)
"Define a dispatcher command. COMMAND is a symbol or a list of symbols "Define a dispatcher command. COMMAND is a symbol or a list of symbols
representing the aliases for this command. DESC is a string description. The representing the aliases for this command. DESC is a string description. The
first line should be short (under 60 letters), as it will be displayed for first line should be short (under 60 letters), as it will be displayed for
@ -151,7 +151,7 @@ BODY will be run when this dispatcher is called."
;;; Dispatch commands ;;; Dispatch commands
;; Load all of our subcommands ;; Load all of our subcommands
(def-command! (refresh re) (&rest args) (defcli! (refresh re) (&rest args)
"Ensure Doom is properly set up. "Ensure Doom is properly set up.
This is the equivalent of running autoremove, install, autoloads, then This is the equivalent of running autoremove, install, autoloads, then
@ -188,9 +188,9 @@ stale."
;; Load all of our subcommands ;; Load all of our subcommands
(load! "cli/install") (load! "cli/install")
(def-command-group! "Diagnostics" (defcligroup! "Diagnostics"
"For troubleshooting and diagnostics" "For troubleshooting and diagnostics"
(def-command! (doctor doc) () (defcli! (doctor doc) ()
"Checks for issues with your environment & Doom config. "Checks for issues with your environment & Doom config.
Use the doctor to diagnose common problems or list missing dependencies in Use the doctor to diagnose common problems or list missing dependencies in
@ -199,7 +199,7 @@ enabled modules.")
(load! "cli/debug") (load! "cli/debug")
(load! "cli/test")) (load! "cli/test"))
(def-command-group! "Maintenance" (defcligroup! "Maintenance"
"For managing your config and packages" "For managing your config and packages"
(load! "cli/env") (load! "cli/env")
(load! "cli/upgrade") (load! "cli/upgrade")
@ -207,13 +207,13 @@ enabled modules.")
(load! "cli/autoloads") (load! "cli/autoloads")
(load! "cli/patch-macos")) (load! "cli/patch-macos"))
(def-command-group! "Byte compilation" (defcligroup! "Byte compilation"
"For byte-compiling Doom and your config" "For byte-compiling Doom and your config"
(load! "cli/byte-compile")) (load! "cli/byte-compile"))
(def-command-group! "Utilities" (defcligroup! "Utilities"
"Conveniences for interacting with Doom externally" "Conveniences for interacting with Doom externally"
(def-command! run () (defcli! run ()
"Run Doom Emacs from bin/doom's parent directory. "Run Doom Emacs from bin/doom's parent directory.
All arguments are passed on to Emacs (except for -p and -e). All arguments are passed on to Emacs (except for -p and -e).