about summary refs log tree commit diff
path: root/Completion/Unix/Command/_unison
diff options
context:
space:
mode:
authorHenri Menke <henri@icp.uni-stuttgart.de>2020-03-29 17:07:31 +1300
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-29 20:17:29 +0000
commit83f7dc780661ca471ac70fc2b1d5aa6247c7c189 (patch)
treee7b43706e3998c8730f726a7c4468d6ec75f7829 /Completion/Unix/Command/_unison
parenta6610c4a17637cde780f9088273929071b742ef8 (diff)
downloadzsh-83f7dc780661ca471ac70fc2b1d5aa6247c7c189.tar.gz
zsh-83f7dc780661ca471ac70fc2b1d5aa6247c7c189.tar.xz
zsh-83f7dc780661ca471ac70fc2b1d5aa6247c7c189.zip
45646: completion: Unison: Honour the $UNISON variable
By default Unison uses the ~/.unison directory to store its cache and
profiles.  However, this location is configurable through the $UNISON
environment variable.  Quoting from the manual [1]:

> If the environment variable UNISON is defined, then its value will be
> used as the name of this directory.

This patch enables users to move the .unison directory and still enjoy
zsh completion for profiles.

[1] https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#unisondir
Diffstat (limited to 'Completion/Unix/Command/_unison')
-rw-r--r--Completion/Unix/Command/_unison4
1 files changed, 2 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison
index 2a3333742..d8cf7458f 100644
--- a/Completion/Unix/Command/_unison
+++ b/Completion/Unix/Command/_unison
@@ -86,7 +86,7 @@ _arguments \
 if [[ $state == profile ]]; then
     local -a profiles
 
-    profiles=( ~/.unison/*.prf(N) )
+    profiles=( ${UNISON:-~/.unison}/*.prf(N) )
     (( $#profiles )) && \
-	compadd "$@" - ${${profiles#~/.unison/}%.prf}
+	compadd "$@" - ${${profiles#${UNISON:-~/.unison}/}%.prf}
 fi