From 278184071bd9f9c20571b1a7f381ed24ff551759 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 30 Apr 2010 11:07:46 +0200 Subject: [PATCH] [Zsh] kirkwood env update + Trash --- .zsh/70_Trash.zsh | 65 ++++++++++++++++++++++++++++++ .zsh/host:kirkwood/Environment.zsh | 3 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .zsh/70_Trash.zsh diff --git a/.zsh/70_Trash.zsh b/.zsh/70_Trash.zsh new file mode 100644 index 0000000..0dbe042 --- /dev/null +++ b/.zsh/70_Trash.zsh @@ -0,0 +1,65 @@ +## +## Part of configuration files for Zsh4 +## AUTHOR: Hugues Hiegel +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## + +TRASH=$ZDOTDIR/.trash + +move_to_trash () +{ + FOLDER=$TRASH/$PWD + + for element in $@ + do + if [ -e $element ] + then + echo "Deleting $element..." + mkdir -p $FOLDER/${element:h} + mv -f $element $FOLDER/${element:h}/. + fi + done +} + +list_deleted_elements () +{ + FOLDER=$TRASH/$PWD + + if [ -d $FOLDER ] + then + ls -lad $(find $FOLDER -maxdepth 1 ! -wholename $FOLDER) | sed "s:$FOLDER/::" + else + echo "Nothing found in trash." + fi +} + +undelete_from_trash () +{ + FOLDER=$TRASH/$PWD + + for element in $@ + do + if [ -e $FOLDER/$element ] + then + echo "Getting back $element..." + mkdir -p ${element:h} + mv $FOLDER/$element . + rmdir --ignore-fail-on-non-empty -p $FOLDER + else + echo "Not found in trash: $element" + fi + done +} + +alias delete='move_to_trash' +alias undelete='undelete_from_trash' +alias lsdeleted='list_deleted_elements' + +alias cdtrash='cd $TRASH/$PWD' +alias sotrash='cd ${PWD/$TRASH/}' + +hash -d trash=$TRASH diff --git a/.zsh/host:kirkwood/Environment.zsh b/.zsh/host:kirkwood/Environment.zsh index 510da86..1d59290 100755 --- a/.zsh/host:kirkwood/Environment.zsh +++ b/.zsh/host:kirkwood/Environment.zsh @@ -8,7 +8,8 @@ export ANDROID_HOME=$HOME/Android/android-sdk-linux_86 export ANDROID_SKD=$ANDROID_HOME/platforms/android-1.6/ export ECLIPSE_HOME=$HOME/Tools/eclipse export NETBEANS_HOME=$HOME/netbeans-6.8 -export PATH=$NETBEANS_HOME/bin:$JAVA_HOME/bin/:$ANDROID_HOME/tools:$ANDROID_SKD/tools:$ECLIPSE_HOME:$PATH +export OOFICE_HOME=/opt/openoffice.org3/program +export PATH=$NETBEANS_HOME/bin:$JAVA_HOME/bin/:$ANDROID_HOME/tools:$ANDROID_SKD/tools:$ECLIPSE_HOME:$OOFICE_HOME:$PATH #Perso Bin export PATH=$HOME/bin/bin:$HOME/bin:$PATH