Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] completion: Unison uses the $UNISON variable

Dear zsh maintainers,

Please find attached my improvement for the Unison completion file.
Details as to why this patch is necessary are in the commit message.

If you need clarification or want me to improve the patch, please reply
to me directly, as I am not subscribed to the list.

Kind regards,

From ba2b421f957a42378ac180827c07a27d0946630a Mon Sep 17 00:00:00 2001
From: Henri Menke <henri@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 29 Mar 2020 17:07:31 +1300
Subject: [PATCH] completion: Unison uses 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
 Completion/Unix/Command/_unison | 4 ++--
 1 file 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}

Messages sorted by: Reverse Date, Date, Thread, Author