mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(cli): defcli-obsolete!: allow arbitrary obsolescence message
Ala `make-obsolete`.
This commit is contained in:
@ -1750,20 +1750,27 @@ TARGET is not a command specification, and should be a command list."
|
|||||||
See `defcli!' for information about COMMANDSPEC.
|
See `defcli!' for information about COMMANDSPEC.
|
||||||
TARGET is simply a command list.
|
TARGET is simply a command list.
|
||||||
WHEN specifies what version this command was rendered obsolete."
|
WHEN specifies what version this command was rendered obsolete."
|
||||||
`(let ((ncommand (doom-cli-command-normalize (backquote ,target) doom-cli--group-plist)))
|
`(let* ((target (backquote ,target)))
|
||||||
(defcli! ,commandspec (&context _context &cli cli &rest args)
|
(defcli! ,commandspec (&context _context &cli cli &rest args)
|
||||||
:docs (format "An obsolete alias for '%s'." (doom-cli-command-string ncommand))
|
:docs (if (stringp target)
|
||||||
:obsolete (cons ncommand ,when)
|
(format "An obsolete command: %s" target)
|
||||||
|
(format "An obsolete alias for '%s'."
|
||||||
|
(doom-cli-command-string
|
||||||
|
(doom-cli-command-normalize target doom-cli--group-plist))))
|
||||||
|
:obsolete (cons target ,when)
|
||||||
:hide t
|
:hide t
|
||||||
(let* ((obsolete (plist-get (doom-cli-plist cli) :obsolete))
|
(cl-destructuring-bind (target . when)
|
||||||
(newcmd (car obsolete))
|
(plist-get (doom-cli-plist cli) :obsolete)
|
||||||
(when (cdr obsolete)))
|
(print! (warn "'%s' was %s in %s")
|
||||||
(print! (warn "'%s' was deprecated in %s")
|
|
||||||
(doom-cli-command-string cli)
|
(doom-cli-command-string cli)
|
||||||
|
(if (stringp target) "removed" "deprecated")
|
||||||
when)
|
when)
|
||||||
(print! (warn "It will eventually be removed; use '%s' instead.")
|
(if (stringp target)
|
||||||
(doom-cli-command-string newcmd))
|
(print! (warn "%s." target))
|
||||||
(call! ',target args)))))
|
(setq target (doom-cli-command-normalize target doom-cli--group-plist))
|
||||||
|
(print! (warn "It will eventually be removed; use '%s' instead.")
|
||||||
|
(doom-cli-command-string target))
|
||||||
|
(call! ',target args))))))
|
||||||
|
|
||||||
(defmacro defcli-stub! (commandspec &optional _argspec &rest body)
|
(defmacro defcli-stub! (commandspec &optional _argspec &rest body)
|
||||||
"Define a stub CLI, which will throw an error if invoked.
|
"Define a stub CLI, which will throw an error if invoked.
|
||||||
|
Reference in New Issue
Block a user