docs(cli): show correct command in error message
Before: $ doom ci hook commit-msg test Error: "doom ci" expected 0 arguments, but got 1 Usage: doom ci COMMAND [ARGS...] See 'doom h[elp] ci' or 'doom ci {-?,--help}' for documentation. After: $ doom ci hook commit-msg test Error: ":before doom ci" expected 0 arguments, but got 1 Usage: doom ci hook commit-msg FILE See 'doom h[elp] ci hook commit-msg' or 'doom ci hook commit-msg {-?,--help}' for documentation.
This commit is contained in:
parent
50a0c2ef46
commit
ab7f7058f3
1 changed files with 6 additions and 3 deletions
|
@ -375,7 +375,7 @@ Return nil if CLI (a `doom-cli') has no explicit documentation."
|
|||
(when (or (< argc min)
|
||||
(> argc max))
|
||||
(signal 'doom-cli-wrong-number-of-arguments-error
|
||||
(list (doom-cli--command context) nil args min max)))
|
||||
(list (doom-cli-key cli) nil args min max)))
|
||||
(dolist (sym spec)
|
||||
(setf (alist-get sym alist) (if args (pop args))))
|
||||
(dolist (type `((&args . ,args)
|
||||
|
@ -1667,14 +1667,17 @@ errors to `doom-cli-error-file')."
|
|||
(doom-cli-wrong-number-of-arguments-error
|
||||
(pcase-let ((`(,command ,flag ,args ,min ,max) (cdr e)))
|
||||
(print! (red "Error: %S expected %s argument%s, but got %d")
|
||||
(or flag (doom-cli-command-string (cdr command)))
|
||||
(or flag (doom-cli-command-string
|
||||
(if (keywordp (car command))
|
||||
command
|
||||
(cdr command))))
|
||||
(if (or (= min max)
|
||||
(= max most-positive-fixnum))
|
||||
min
|
||||
(format "%d-%d" min max))
|
||||
(if (or (= min 0) (> min 1)) "s" "")
|
||||
(length args))
|
||||
(doom-cli-call `(:help "--synopsis" "--postamble" ,@(cdr command)) context e))
|
||||
(doom-cli-call `(:help "--synopsis" "--postamble" ,@(cdr (doom-cli--command context))) context e))
|
||||
5)
|
||||
(doom-cli-unrecognized-option-error
|
||||
(print! (red "Error: unknown option %s") (cadr e))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue