mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
parent
3935ccce64
commit
81eb208987
1 changed files with 11 additions and 3 deletions
14
plugins/wd/wd.sh
Normal file → Executable file
14
plugins/wd/wd.sh
Normal file → Executable file
|
@ -183,6 +183,11 @@ wd_add()
|
||||||
then
|
then
|
||||||
wd_remove $point > /dev/null
|
wd_remove $point > /dev/null
|
||||||
printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG
|
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
|
wd_export_static_named_directories
|
||||||
|
|
||||||
|
@ -342,8 +347,8 @@ wd_clean() {
|
||||||
wd_export_static_named_directories() {
|
wd_export_static_named_directories() {
|
||||||
if [[ -z $WD_SKIP_EXPORT ]]
|
if [[ -z $WD_SKIP_EXPORT ]]
|
||||||
then
|
then
|
||||||
grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read warpdir ; do
|
command grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read warpdir ; do
|
||||||
hash -d "$warpdir"
|
hash -d "$warpdir"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -430,7 +435,10 @@ else
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
"-r"|"--remove"|"rm")
|
"-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
|
break
|
||||||
;;
|
;;
|
||||||
"-l"|"list")
|
"-l"|"list")
|
||||||
|
|
Loading…
Reference in a new issue