mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Merge 51c2b4561d into eae6c38ea8
This commit is contained in:
commit
54ac09b1a9
1 changed files with 11 additions and 12 deletions
|
|
@ -138,20 +138,19 @@ function man-preview() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function trash() {
|
function trash() {
|
||||||
local trash_dir="${HOME}/.Trash"
|
local files
|
||||||
local temp_ifs=$IFS
|
files=()
|
||||||
IFS=$'\n'
|
|
||||||
for item in "$@"; do
|
for item in "$@"; do
|
||||||
if [[ -e "$item" ]]; then
|
files=($files "POSIX file \"$(cd "$(dirname "$item")"; pwd)/$(basename "$item")\"")
|
||||||
item_name="$(basename $item)"
|
|
||||||
if [[ -e "${trash_dir}/${item_name}" ]]; then
|
|
||||||
mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
|
|
||||||
else
|
|
||||||
mv -f "$item" "${trash_dir}/"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
IFS=$temp_ifs
|
osascript &> /dev/null <<EOF
|
||||||
|
tell application "Finder" to delete {${(j:, :)files}}
|
||||||
|
EOF
|
||||||
|
local code=$?
|
||||||
|
if [[ $code -eq 1 ]]; then
|
||||||
|
echo "Item doesn't exist (${(j:, :)files})"
|
||||||
|
return $code
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function vncviewer() {
|
function vncviewer() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue