From: zimoun <zimon.toutoune@gmail.com>
To: 46308@debbugs.gnu.org
Cc: zimoun <zimon.toutoune@gmail.com>
Subject: [bug#46308] [PATCH 1/1] guix: scripts: Fix corner cases of hint for option typo.
Date: Fri, 5 Feb 2021 00:02:50 +0100 [thread overview]
Message-ID: <20210204230250.3304-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20210204230028.2275-1-zimon.toutoune@gmail.com>
* guix/scripts.scm (option-hint): Fix corner cases.
---
guix/scripts.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/guix/scripts.scm b/guix/scripts.scm
index c9ea9f2e29..1773894bc2 100644
--- a/guix/scripts.scm
+++ b/guix/scripts.scm
@@ -118,7 +118,12 @@ procedure, but both the category and synopsis are meant to be read (parsed) by
according to'string-distance'."
(define (options->long-names options)
(filter string? (append-map option-names options)))
- (string-closest guess (options->long-names options) #:threshold 3))
+ (match guess
+ ((? string?)
+ (match (string-split guess #\=)
+ ((name rest ...)
+ (string-closest name (options->long-names options) #:threshold 3))))
+ (_ #f)))
(define (args-fold* args options unrecognized-option-proc operand-proc . seeds)
"A wrapper on top of `args-fold' that does proper user-facing error
--
2.29.2
next prev parent reply other threads:[~2021-02-04 23:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 23:00 [bug#46308] [PATCH 0/1] Fix 2 corner cases for option hint zimoun
2021-02-04 23:02 ` zimoun [this message]
2021-02-24 22:51 ` bug#46308: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210204230250.3304-1-zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=46308@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.