Avoid showing traceback in z and zi

This commit is contained in:
Ajeet D'Souza 2021-08-24 01:50:57 +05:30
parent e83475181e
commit b3e7c67512
2 changed files with 16 additions and 3 deletions

View File

@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### 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 ## [0.7.4] - 2020-08-15

View File

@ -52,14 +52,26 @@ fn __zoxide_z [@rest]{
} elif (and ('builtin:==' (builtin:count $rest) 1) (path:is-dir &follow-symlink=$true $rest[0])) { } elif (and ('builtin:==' (builtin:count $rest) 1) (path:is-dir &follow-symlink=$true $rest[0])) {
__zoxide_cd $rest[0] __zoxide_cd $rest[0]
} else { } 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~ edit:add-var __zoxide_z~ $__zoxide_z~
# Jump to a directory using interactive search. # Jump to a directory using interactive search.
fn __zoxide_zi [@rest]{ 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~ edit:add-var __zoxide_zi~ $__zoxide_zi~