fix(cli): wrong-type-arg error on unrecognized command
If you type an unrecognized command, you get an "Error: unrecognized
command X" error, then a list of similar commands, followed by a
recommendation to check out 'doom help Y' or 'doom --help Y', where Y is
the nearest recognized parent command. E.g. 'doom ci blah' is an unknown
command, but 'doom ci' is known, therefore Y = 'doom ci'.
This fix ensures that Y is properly resolved.
Amend: 6c0b7e1530
This commit is contained in:
parent
446e1432bc
commit
6eefd4c1df
1 changed files with 2 additions and 2 deletions
|
@ -49,7 +49,7 @@ OPTIONS:
|
|||
(cli (doom-cli-get command t))
|
||||
(rcli (doom-cli-get cli))
|
||||
(fallbackcli (cl-loop with targets = (doom-cli--command-expand (butlast command) t)
|
||||
for cmd in (cons command (nreverse targets))
|
||||
for cmd in (cons command targets)
|
||||
if (doom-cli-get cmd t)
|
||||
return it)))
|
||||
(cond (commands?
|
||||
|
@ -112,7 +112,7 @@ OPTIONS:
|
|||
(print! "See %s for documentation."
|
||||
(join (cl-loop with spec =
|
||||
`((?p . ,(doom-cli-context-prefix context))
|
||||
(?c . ,(doom-cli-command-string (cdr (doom-cli-command cli)))))
|
||||
(?c . ,(doom-cli-command-string (cdr (doom-cli-command (or cli fallbackcli))))))
|
||||
for cmd in doom-help-commands
|
||||
for formatted = (trim (format-spec cmd spec))
|
||||
collect (replace-regexp-in-string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue