From 9ad75a54c713b487f1ed5c13b99cfa3ce8d3f35c Mon Sep 17 00:00:00 2001 From: Leonid Shevtsov Date: Tue, 18 Nov 2014 10:55:01 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Port=20=E2=80=9CTest=20/=20create=20errors?= =?UTF-8?q?=20directory=20before=20writing=20to=20it.=20(573c1ea418aaf40d8?= =?UTF-8?q?c25dc8f799435e1f9f97bd5)=E2=80=9D=20to=20fish=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/autojump.fish | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/autojump.fish b/bin/autojump.fish index e4b6026..0a2815f 100644 --- a/bin/autojump.fish +++ b/bin/autojump.fish @@ -19,11 +19,18 @@ else set -x AUTOJUMP_ERROR_PATH ~/.local/share/autojump/errors.log end +if test ! -d "(dirname $AUTOJUMP_ERROR_PATH)" + mkdir -p "(dirname $AUTOJUMP_ERROR_PATH)" +end # change pwd hook function __aj_add --on-variable PWD status --is-command-substitution; and return - autojump --add (pwd) >/dev/null 2>>$AUTOJUMP_ERROR_PATH & + if test -f "$AUTOJUMP_ERROR_PATH" + autojump --add (pwd) >/dev/null 2>>$AUTOJUMP_ERROR_PATH & + else + autojump --add (pwd) >/dev/null & + end end From 10dede00921b63c3b07d1b873be68bce0e7cfc7d Mon Sep 17 00:00:00 2001 From: Leonid Shevtsov Date: Tue, 18 Nov 2014 10:55:21 +0200 Subject: [PATCH 2/3] Fix fish shell conditional syntax --- bin/autojump.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/autojump.fish b/bin/autojump.fish index 0a2815f..b6635aa 100644 --- a/bin/autojump.fish +++ b/bin/autojump.fish @@ -11,7 +11,7 @@ complete -x -c j -a '(autojump --complete (commandline -t))' # set error file location -if (uname) == "Darwin" +if test (uname) = "Darwin" set -x AUTOJUMP_ERROR_PATH ~/Library/autojump/errors.log else if test -d $XDG_DATA_HOME set -x AUTOJUMP_ERROR_PATH $XDG_DATA_HOME/autojump/errors.log From 63e1587515a945a605b5664153a2124486e4dc0a Mon Sep 17 00:00:00 2001 From: Leonid Shevtsov Date: Mon, 1 Dec 2014 16:25:44 +0200 Subject: [PATCH 3/3] Fixes to fish script quoting --- bin/autojump.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/autojump.fish b/bin/autojump.fish index b6635aa..0699417 100644 --- a/bin/autojump.fish +++ b/bin/autojump.fish @@ -19,15 +19,15 @@ else set -x AUTOJUMP_ERROR_PATH ~/.local/share/autojump/errors.log end -if test ! -d "(dirname $AUTOJUMP_ERROR_PATH)" - mkdir -p "(dirname $AUTOJUMP_ERROR_PATH)" +if test ! -d (dirname "$AUTOJUMP_ERROR_PATH") + mkdir -p (dirname "$AUTOJUMP_ERROR_PATH") end # change pwd hook function __aj_add --on-variable PWD status --is-command-substitution; and return if test -f "$AUTOJUMP_ERROR_PATH" - autojump --add (pwd) >/dev/null 2>>$AUTOJUMP_ERROR_PATH & + autojump --add (pwd) >/dev/null 2>>"$AUTOJUMP_ERROR_PATH" & else autojump --add (pwd) >/dev/null & end