From b3e7c675126e506410bb14e19c91c5090f78361e Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Tue, 24 Aug 2021 01:50:57 +0530 Subject: [PATCH] Avoid showing traceback in z and zi --- CHANGELOG.md | 3 ++- templates/elvish.txt | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a48f05..898f9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Elvish: errors on 0.16.0. +- Elvish: unable to `z` into directories by path. +- Elvish: don't show traceback when `z` or `zi` fails. ## [0.7.4] - 2020-08-15 diff --git a/templates/elvish.txt b/templates/elvish.txt index 6fd413f..4c67b12 100644 --- a/templates/elvish.txt +++ b/templates/elvish.txt @@ -52,14 +52,26 @@ fn __zoxide_z [@rest]{ } elif (and ('builtin:==' (builtin:count $rest) 1) (path:is-dir &follow-symlink=$true $rest[0])) { __zoxide_cd $rest[0] } else { - __zoxide_cd (zoxide query --exclude $pwd -- $@rest) + var path + try { + path = (zoxide query --exclude $pwd -- $@rest) + } except { + } else { + __zoxide_cd $path + } } } edit:add-var __zoxide_z~ $__zoxide_z~ # Jump to a directory using interactive search. fn __zoxide_zi [@rest]{ - __zoxide_cd (zoxide query -i -- $@rest) + var path + try { + path = (zoxide query -i -- $@rest) + } except { + } else { + __zoxide_cd $path + } } edit:add-var __zoxide_zi~ $__zoxide_zi~