tweak(cli): improve message when no similar commands found

Rather than display a blank line, let the user know no similar commands
were found.
This commit is contained in:
Henrik Lissner 2022-06-19 13:02:34 +02:00
parent 6eefd4c1df
commit 49ef0fa8dd
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -86,12 +86,14 @@ OPTIONS:
("--similar"
(unless command
(user-error "No command specified"))
(when-let (similar (doom-cli-help-similar-commands command 0.4))
(let ((similar (doom-cli-help-similar-commands command 0.4)))
(print! "Similar commands:")
(if (not similar)
(print! (indent (warn "Can't find any!")))
(dolist (command (seq-take similar 10))
(print! (indent (item "(%d%%) %s"))
(* (car command) 100)
(doom-cli-command-string (cdr command))))))
(doom-cli-command-string (cdr command)))))))
("--envvars"
(let* ((key "ENVIRONMENT VARIABLES")
(clis (if command (doom-cli-find command) (hash-table-values doom-cli--table)))