From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17076 invoked from network); 14 Sep 2023 02:53:54 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Sep 2023 02:53:54 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1694660034; b=a1noVRWKUqR5z9gTAy4ZFrjlrT8lp2RLUrjx5BYp+NnharZi8EwHYc7jdm8jkjNZHclJYm9GPH B3hohZ9NwWc6I9aU1y42KcUlaQRLNop30jjIgbkYkPSBP7/iLj5JXywUX7U1lHT1H+EgAkDPjm lHWfKDgALwg0gn4557C20v2l54rZQajpoPAQuoYxdUSs2awPyl9Kd184ixaDWlpgFg2uI+SOWZ XqZYmaboE+J551+u62DlHl94lhr7/5fRMTQcsKuOLmC3zL1OUx5n6zGL0XTzj+BKGUrFSRxD6y oyo1d/V6iTYSF/8NRkg/UaJdsoQKWIGlF+FvM0tQ6ZVfCg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (lxh-heta-043.node.capitar.com) smtp.remote-ip=159.69.137.90; dmarc=none header.from=opperschaap.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1694660034; bh=rCQBqhqvxJHJB6fSpZajlz7jSNEsOzy8MWypdfnHI2w=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:DKIM-Signature; b=jn1rKOS2usHwySwWicgDGGo+D3AfA53p4d1acVOKhzpns3jvxr55jYYjud7kYkENnO6QK59A13 tWb7DlgG56atsY2VmxbrlKizJTGHeRqb/I+juvNiVz7TJx9I7UuM2Vcox2vvVoA42r+4DRJ+Bv gea5tj6oeVM1F4oYAWcc5+XExtH+Tvg8BDO5Qhem8PYuMcxfZr+j7cAoBotnZTWF5GvU/STzCA cEdIW/YyyVlrtzC0qrOhA7ItvsMJkztKZOQUGKAc8ZC0+Fv4J+hM8nzAKenLRLrAx2PULoXjkA Tgr5PtGNVqdd3+l6xd+Y1XJPRnpbirf98ZgLnrQR0xfrsQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Nvy3db+Wnb+pivjMZd/95SVa5K2WFkYmFEDIsPpH0mU=; b=WcA/ubxgFUQxKMtVL/yWBXmWp8 Eo4GvB87eLwXFOpD6lWy2nDa7OXC5Vm2h54lQH/v7sAyw8JF2XITq+xIw5k4k2A5umDRcNC3FuHN/ F3qh4QUP1RTJJbfs7TwHw+yae1WWhrYM/LribNtP9HhFXH7mx++0HhgNWt+gTHy4L/F9AAqya+8NE fiWpr789fnPxVkvCmuO82WQis5pNg/kGCBLq0iiufyWH9tWz1YyIvXkMlUnZjV7wQRpRPeYTDlBrw prgNeLsNlb7/RRWYbaxJGHT2/MHDtD8Q/2aUVUOFgFV3RyzwCBO1rxaWx0mk3CxsKnc0U5ljTmlt1 XdfBimmw==; Received: by zero.zsh.org with local id 1qgcUJ-00035t-NQ; Thu, 14 Sep 2023 02:53:51 +0000 Authentication-Results: zsh.org; iprev=pass (lxh-heta-043.node.capitar.com) smtp.remote-ip=159.69.137.90; dmarc=none header.from=opperschaap.net; arc=none Received: from lxh-heta-043.node.capitar.com ([159.69.137.90]:4394) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qgcU1-0002oL-H5; Thu, 14 Sep 2023 02:53:34 +0000 Received: from lxh-heta-043.node.capitar.com (localhost [127.0.0.1]) by eur-mail-proxy-p02.zt.capitar.com (Postfix) with ESMTPS id A3F0D20463; Thu, 14 Sep 2023 04:53:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eur-mail-proxy-p02.zt.capitar.com (Postfix) with ESMTP id 2611B20277; Thu, 14 Sep 2023 04:53:32 +0200 (CEST) Received: from lxh-heta-043.node.capitar.com ([127.0.0.1]) by localhost (eur-mail-proxy-p02.zt.capitar.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2RA96FNdOCQB; Thu, 14 Sep 2023 04:53:31 +0200 (CEST) Received: from neptune.setarnet.aw (unknown [186.189.151.69]) by eur-mail-proxy-p02.zt.capitar.com (Postfix) with ESMTPSA id 6D30F2062F; Thu, 14 Sep 2023 04:53:29 +0200 (CEST) From: Wesley Schwengle To: zsh-workers@zsh.org Subject: [PATCH v2]] completion: _git: Add trailer token completion for git commit --trailer Date: Wed, 13 Sep 2023 22:53:04 -0400 Message-ID: <20230914025304.3600661-1-wesleys@opperschaap.net> X-Mailer: git-send-email 2.42.0.465.g461bb28fbd In-Reply-To: <20230912181650.3193132-1-wesleys@opperschaap.net> References: <20230912181650.3193132-1-wesleys@opperschaap.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=GP927dFK c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=Hb/lXKkKiutk7skFILyYNg==:17 a=zNV7Rl7Rt7sA:10 a=N3miCFJ7AAAA:8 a=N-Ek3KfysbdPPG7GkpsA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=V5H4rQgsk92nlYCD-KPC:22 X-Seq: 52141 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Via 842587016d in the git project there has been support for git commit trailer tokens for the bash completion system. This commit adds similar support to zsh. It includes additional hardening of the regexp and allows for tokens which include a '.'. This can be found in git via 9a0ec17606. Signed-off-by: Wesley Schwengle --- Completion/Unix/Command/_git | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1d4fe20c9..3b9041303 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -717,7 +717,7 @@ _git-commit () { {-p,--patch}'[use the interactive patch selection interface to chose= which changes to commit]' \ '(--reset-author)--author[override the author name used in the commi= t]:author name' \ '--date=3D[override the author date used in the commit]:date' \ - '*--trailer=3D[add custom trailer(s)]:trailer' \ + '*--trailer=3D[add custom trailer(s)]:trailer :__git_trailers_tokens= ' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end= of the commit message]' \ '(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg= hooks]' \ '--allow-empty[allow recording an empty commit]' \ @@ -7413,6 +7413,20 @@ __git_deleted_files () { __git_files --deleted deleted-files 'deleted file' $* } =20 + +(( $+functions[__git_trailers_tokens] )) || +__git_trailers_tokens () { + declare -a trailers + + local -a gtrailers=3D($(git config --name-only --get-regexp '^trailer\= ..*\.key$')) + for i ("$gtrailers[@]") + do + i=3D(${${(@s:.:)i}[2,-2]}); + trailers+=3D(${(j|.|)i}) + done + _wanted trailer expl "trailer" compadd -a trailers +} + (( $+functions[__git_modified_files] )) || __git_modified_files () { __git_files --modified modified-files 'modified file' $* --=20 2.42.0.465.g461bb28fbd