From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id l31fJjh9HGC6IAAA0tVLHw (envelope-from ) for ; Thu, 04 Feb 2021 23:03:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id iCnXITh9HGCBUAAA1q6Kng (envelope-from ) for ; Thu, 04 Feb 2021 23:03:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 47114940466 for ; Thu, 4 Feb 2021 23:03:20 +0000 (UTC) Received: from localhost ([::1]:33452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7neh-0006hV-90 for larch@yhetil.org; Thu, 04 Feb 2021 18:03:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7neP-0006fv-V7 for guix-patches@gnu.org; Thu, 04 Feb 2021 18:03:01 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7neP-0003Co-LD for guix-patches@gnu.org; Thu, 04 Feb 2021 18:03:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7neP-0007RS-J5 for guix-patches@gnu.org; Thu, 04 Feb 2021 18:03:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46308] [PATCH 1/1] guix: scripts: Fix corner cases of hint for option typo. References: <20210204230028.2275-1-zimon.toutoune@gmail.com> In-Reply-To: <20210204230028.2275-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Feb 2021 23:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46308 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46308@debbugs.gnu.org Cc: zimoun Received: via spool by 46308-submit@debbugs.gnu.org id=B46308.161247978028597 (code B ref 46308); Thu, 04 Feb 2021 23:03:01 +0000 Received: (at 46308) by debbugs.gnu.org; 4 Feb 2021 23:03:00 +0000 Received: from localhost ([127.0.0.1]:42456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7neN-0007RA-Vf for submit@debbugs.gnu.org; Thu, 04 Feb 2021 18:03:00 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:37350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7neM-0007QH-CX for 46308@debbugs.gnu.org; Thu, 04 Feb 2021 18:02:59 -0500 Received: by mail-wr1-f48.google.com with SMTP id v15so5520068wrx.4 for <46308@debbugs.gnu.org>; Thu, 04 Feb 2021 15:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FZr0outj+Lnzvw9XZ9rzKv4v4fM7mGuJ83CEhwsMelg=; b=Tn8N6ySyOq3x9nJFHgcrzf+ZytKnqd1CTEWpa1ApyI/djpU1W61jSMdpzjES8o27Si NPdAAlj6xQgxJzSzhGhGtcy140p+UhmK9331TDzcUuNdgqKMsA6Z0BNJmFg4mZnifmos I3ZXZhA5OJjLDIG894ytoV2B3QK2oE6mtJssoo/4Ix5AcWCIqePWIsWe/sSWRXWhHJC3 aareMW/ZT6RIxPHv47IzGobnizP7Kyh5D9RA0vcD1Vhb9/gquRnzfp82DgcZgnuSaQk5 8Ow+YBJrO01QFv0Zq18HaUGvV1ix8J9IcXtjKSNDvH3O/rij9+m0OIzczqI8ohvZdpY+ b2sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FZr0outj+Lnzvw9XZ9rzKv4v4fM7mGuJ83CEhwsMelg=; b=KWRR3Zx+sninn7aOq5NrQ8x/pCi2ZiRSjgAnbi8hff0vIYkZMooL+zcy5y58g73aiP yaED9OkY/ZJQApj8D39gVkJx/n9fh6N7nvsGVgqy9+YrXLunv2BIXeDBCENxzx5geEVD kmGWD+Kc/s15PQtoReT+ME36EOIhRsUJkVo7+Bgb/bfuy+nLWJkZWe2E1SXgcX+81mu1 kU1JyxOFYZaLWFeXPupPEI6ww1HyvR3g+XmWGYcBfSR99gXj2jRsMpkpAKdTIuHnhDtc qEPn6UuhRTMnEV27jXtHjk0YZ6yGSwwZBAZv2MoijyPYnbrvGwtl5SAaYeUf55j86oNI JBZw== X-Gm-Message-State: AOAM530le+z8pqyup4ZXThH+/aaIMI2tvcPPI0HYnP4GkgxSpMucsIYY 5Ezb5K+hYFslZfcXlbJUnCr5wHlyusM= X-Google-Smtp-Source: ABdhPJws12c3TKPIDwPI0xcSzirB2nh3+34Tc3KPDMN7pIdw7LXhe4bz3AVASP532r1gecLF17Sn+g== X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr1723412wri.105.1612479772418; Thu, 04 Feb 2021 15:02:52 -0800 (PST) Received: from lili.univ-paris-diderot.fr ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id 23sm7214352wmo.47.2021.02.04.15.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 15:02:52 -0800 (PST) From: zimoun Date: Fri, 5 Feb 2021 00:02:50 +0100 Message-Id: <20210204230250.3304-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 4.25 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Tn8N6ySy; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 47114940466 X-Spam-Score: 4.25 X-Migadu-Scanner: scn1.migadu.com X-TUID: HYO/zQEuH0D/ * 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