From edd9798de765049a904e0afa830b191d1932087d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Jan 2017 18:15:35 +0000 Subject: 40403/0003: vcs_info set-patch-format helper: Part #3. --- Functions/VCS_Info/VCS_INFO_set-patch-format | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format') diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index 0bbd4742b..664b4563d 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -6,6 +6,8 @@ # $2 - name of a parameter to store the applied-string in # $3 - name of an array parameter to be the argument to gen-unapplied-string # $4 - name of a parameter to store the unapplied-string in +# $5 - context argument for use in zstyle getters +# $6 - name of a parameter to store a patch-format format string in { local REPLY if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then @@ -27,4 +29,11 @@ fi : ${(P)4::=$REPLY} hook_com=() + + if (( ${(P)#1} )); then + zstyle -s "${5}" patch-format REPLY || REPLY="%p (%n applied)" + else + zstyle -s "${5}" nopatch-format REPLY || REPLY="no patch applied" + fi + : ${(P)6::=$REPLY} } -- cgit v1.2.3