feat(bash): Add trash put command

This commit is contained in:
Nikurasu 2024-02-07 15:37:44 +01:00
parent 556c9fb8d7
commit badeeba6a9
Signed by: Nikurasu
GPG key ID: 9E7F14C03EF1F271
3 changed files with 29 additions and 0 deletions

View file

@ -26,3 +26,17 @@ if [ -f "$HOME/Documents/coding/dotfiles/shell/alias/alias" ]; then
. $HOME/Documents/coding/dotfiles/shell/alias/alias
fi
. "$HOME/.cargo/env"
function tp {
if [ -d $1 ]
then
if ! gum confirm "$(basename $1) is directory! Do you really want to delete it?"
then
exit 1
fi
fi
mv $(realpath $1) $HOME/.local/share/Trash/files/
echo -e "[Trash Info]\nPath=$(realpath $1)\nDeletionDate=$(date "+%Y-%m-%dT%H:%M:%S")" > $HOME/.local/share/Trash/info/$(basename $1).trashinfo
gum style --bold --border rounded --border-foreground "#F5A9B8" --foreground "#5BCEFA" "$(basename $1) has been thrown in the bin"
}

View file

@ -0,0 +1,3 @@
#! /usr/bin/env sh
find $HOME/Downloads/ -type f -mtime +14 -print

12
shell/scripts/trash.sh Executable file
View file

@ -0,0 +1,12 @@
#! /usr/bin/env bash
if [ -d $1 ]
then
if ! gum confirm "$(basename $1) is directory! Do you really want to delete it?"
then
exit 1
fi
fi
mv $(realpath $1) $HOME/.local/share/Trash/files/
echo -e "[Trash Info]\nPath=$(realpath $1)\nDeletionDate=$(date "+%Y-%m-%dT%H:%M:%S")" > $HOME/.local/share/Trash/info/$(basename $1).trashinfo
gum style --bold --border rounded --border-foreground "#F5A9B8" --foreground "#5BCEFA" "$(basename $1) has been thrown in the bin"