Skip to content

Commit

Permalink
wd: update to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Aug 5, 2020
1 parent 3935ccc commit 81eb208
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/wd/wd.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 81eb208

Please sign in to comment.