bcc235e1420f39a0dbd8a7672dffc0f0c81e9b53
- Author
- Robin Ramael <robin.ramael@gmail.com>
- Committer
- SuprDewd <suprdewd@gmail.com>
- Date
Message
Added an option to remove file afterwards.
Diff
1diff --git a/lib/functions.zsh b/lib/functions.zsh
2index 4246f881144122cf951fcf74cd4a97fbbf5a629e..914f2ef25a22d141cfd2e8c9c6255e535641274b 100644
3--- a/lib/functions.zsh
4+++ b/lib/functions.zsh
5@@ -39,6 +39,12 @@ function take() {
6 }
7
8 function extract() {
9+ unset REMOVE_ARCHIVE
10+
11+ if test "$1" = "-r"; then
12+ REMOVE=1
13+ shift
14+ fi
15 if [[ -f $1 ]]; then
16 case $1 in
17 *.tar.bz2) tar xvjf $1;;
18@@ -56,7 +62,14 @@ function extract() {
19 *.7z) 7z x $1;;
20 *) echo "'$1' cannot be extracted via >extract<";;
21 esac
22+
23+ if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
24+ echo removing "$1";
25+ /bin/rm "$1";
26+ fi
27+
28 else
29 echo "'$1' is not a valid file"
30 fi
31 }
32+