[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#46308] [PATCH 1/1] guix: scripts: Fix corner cases of hint for opti
From: |
zimoun |
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 |
* 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