GNU bug report logs - #46308
[PATCH 0/1] Fix 2 corner cases for option hint

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Thu, 4 Feb 2021 23:01:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 46308 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: 46308 <at> debbugs.gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: [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





This bug report was last modified 4 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.