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 20871 invoked from network); 12 Sep 2023 18:22:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2023 18:22:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1694542954; b=G3BihnbfmrnPwireWUTBioqpEYJVvUGChbOPBqwwQoMrFBiUQYyZAfxVxnsOCaYXlMrju4loIJ riqBP+uUyz7HCaZsoumCFgu6j5UL/nMeszS9CgyXEoaAHHVjUY9ZjT7+8l5ZQGaotInmittdQY BpekJX9Vr6muVE8U0i0xYkq1mgcpFdlC5gSKs/nLz1ih9b/NOKGvAlaqXFpCkp5ZhizSDGjW7r NS/n9gbYA8cO4UezC/QBJBSeDxVq1P9L+Yj2Jcvc1lKXP+TRfmwUr8QNrEIEvsHfVOSut+f/We nHXZzUbAPFTU5FlWS3Nl3WbQLL60nAeUcqEx2FsYF6pm9A==; 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=1694542954; bh=+dV3ZTfqpczwDYI2aUvlv4U3RLoF1x+rlaYY0JZXsF4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:To:From:DKIM-Signature; b=K0bcZlNMrudnEdsUQCipQBnS6DDpTb1fz1nmGvcDtd+vV5p4tV7qkGgj6sH8GwRtcf1SBFvJMh xwdKhDI8JcqeQkO5DRy6JL0M4rdVPXlTpPo1IEnwTA/egy6Cm6/sJc1BEWVgUhz1eVYm1afZIi pnBx5YVyiL/Z9yUpnBvbABhiCiVwueC74TclRwVCcNLvlaMVmGc+FXfHq5SoXKIRX6RDD4zfRm e+cXowCWWklUND2e+8an4g3jafM3Q45UmeD55N9QEWEF0lZatxXyNj0G2QuM80r0PUDeVRMWbk 9G5smLGBHxsJIvz4fa0SONVoH+XMx73Aod0PH9ugJl38pg==; 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: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:In-Reply-To:References; bh=az8WI3j9T9/jNWWqE1L7imEihUNZfr+s95EoAAQ8kYo=; b=ScpYnJpVNU0idykbHO03Qifo5G iy+OOOrHGaGDR2PRyPTWyAxkcl0TkibaCcNwoDo0Uoiomr+BMoOeFLADhTz+e/nYj52/8I/exbDze m/sFrbXthD05czLon7XjFYJqOKPGBQw8dsAr4v7lbpCqduSe3n4hax8PUr5LikWLnhAhwhWl9zdUi AqsWUj/UIQXrNO3N9oITnW8chN9VwU0NcD47lJI4GtFcDxN7cC+2r1xcDGbJ+Z8+CRyhVsxgUsoTG jcsMjZSuJKjTadGW8SO6BGAxrRsjipQ6e39tk/l4+0asGlV4Ee8E3ZcVJQtqGij0WunAx9/+0W1ul OmUfFUTw==; Received: by zero.zsh.org with local id 1qg81x-000M6p-50; Tue, 12 Sep 2023 18:22:33 +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]:52904) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qg7wc-000LgJ-T7; Tue, 12 Sep 2023 18:17:04 +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 CF79327BFF; Tue, 12 Sep 2023 20:17:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eur-mail-proxy-p02.zt.capitar.com (Postfix) with ESMTP id 5495227D52; Tue, 12 Sep 2023 20:17:01 +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 nd7h9BvCahVw; Tue, 12 Sep 2023 20:17:01 +0200 (CEST) Received: from neptune.setarnet.aw (unknown [186.189.151.69]) by eur-mail-proxy-p02.zt.capitar.com (Postfix) with ESMTPSA id BC5F7280B5; Tue, 12 Sep 2023 20:16:59 +0200 (CEST) From: Wesley Schwengle To: zsh-workers@zsh.org Subject: [PATCH] completion: _git: Add trailer support for git commit --trailer Date: Tue, 12 Sep 2023 14:16:49 -0400 Message-ID: <20230912181650.3193132-1-wesleys@opperschaap.net> X-Mailer: git-send-email 2.42.0.465.g461bb28fbd MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=SPw8q9nH 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: 52135 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 842587016d717394a001a6f8959475bf8df56124 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. Signed-off-by: Wesley Schwengle --- Completion/Unix/Command/_git | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1d4fe20c9..dd2c1ec74 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,19 @@ __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 + trailers+=3D(${${(@s:.:)i}[2]}) + 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