summaryrefslogtreecommitdiff
path: root/Functions/VCS_Info/VCS_INFO_set-patch-format
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-01-23 18:15:35 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-01-25 04:22:32 +0000
commitedd9798de765049a904e0afa830b191d1932087d (patch)
tree5250e62cc187a569e1b94a6ba7b3dd9df0d1b3ee /Functions/VCS_Info/VCS_INFO_set-patch-format
parent270285733442a46cd157ade4600e4073e255a563 (diff)
downloadzsh-edd9798de765049a904e0afa830b191d1932087d.tar.gz
zsh-edd9798de765049a904e0afa830b191d1932087d.zip
40403/0003: vcs_info set-patch-format helper: Part #3.
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format')
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-patch-format9
1 files changed, 9 insertions, 0 deletions
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}
}