From 49ef0fa8dd191cff6451e24692034207816ace0e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 19 Jun 2022 13:02:34 +0200 Subject: [PATCH] tweak(cli): improve message when no similar commands found Rather than display a blank line, let the user know no similar commands were found. --- core/cli/help.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/cli/help.el b/core/cli/help.el index e91d56481..8121196bf 100644 --- a/core/cli/help.el +++ b/core/cli/help.el @@ -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:") - (dolist (command (seq-take similar 10)) - (print! (indent (item "(%d%%) %s")) - (* (car command) 100) - (doom-cli-command-string (cdr command)))))) + (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))))))) ("--envvars" (let* ((key "ENVIRONMENT VARIABLES") (clis (if command (doom-cli-find command) (hash-table-values doom-cli--table)))