diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-08-05 14:19:26 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-08-05 14:19:48 +0200 |
commit | 81eb2089878be5b9cb4a4ba89c2e2f537b14fb7e (patch) | |
tree | d45256b2c03ac4b7da55c2566e56636e21643a4f /plugins/wd/wd.sh | |
parent | 3935ccce647c722bcfdaa771b01613079db20935 (diff) | |
download | zsh-81eb2089878be5b9cb4a4ba89c2e2f537b14fb7e.tar.gz zsh-81eb2089878be5b9cb4a4ba89c2e2f537b14fb7e.tar.bz2 zsh-81eb2089878be5b9cb4a4ba89c2e2f537b14fb7e.zip |
wd: update to latest version
https://github.com/mfaerevaag/wd/commit/3d20d15d58b9349f872a1abab639aae02374f64c
Fixes #9002
Diffstat (limited to 'plugins/wd/wd.sh')
-rwxr-xr-x[-rw-r--r--] | plugins/wd/wd.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index 802ed10ee..618995c63 100644..100755 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -183,6 +183,11 @@ wd_add() then wd_remove $point > /dev/null printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG + if (whence sort >/dev/null); then + local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX") + # use 'cat' below to ensure we respect $WD_CONFIG as a symlink + sort -o "${config_tmp}" $WD_CONFIG && cat "${config_tmp}" > $WD_CONFIG && rm "${config_tmp}" + fi wd_export_static_named_directories @@ -342,8 +347,8 @@ wd_clean() { wd_export_static_named_directories() { if [[ -z $WD_SKIP_EXPORT ]] then - grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read warpdir ; do - hash -d "$warpdir" + command grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read warpdir ; do + hash -d "$warpdir" done fi } @@ -430,7 +435,10 @@ else break ;; "-r"|"--remove"|"rm") - wd_remove $2 + # Loop over all arguments after "rm", separated by whitespace + for pointname in "${@:2}" ; do + wd_remove $pointname + done break ;; "-l"|"list") |