Message ID | 20210204230250.3304-1-zimon.toutoune@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | Fix 2 corner cases for option hint | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Hi,
zimoun <zimon.toutoune@gmail.com> skribis:
> * guix/scripts.scm (option-hint): Fix corner cases.
Applied! I also reverted the change I made in
11f11d7ecb817d1421f8b5340bcced59396d8708, which addressed the
short-option problem you mention.
Thanks,
Ludo’.
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