safe status

This commit is contained in:
q
2019-04-12 11:01:52 +03:00
parent de67182cc8
commit 5678c7e8f9

View File

@@ -2,15 +2,28 @@
set -e
function helpexit() {
echo Delete files by moving to a safe location in your ~/.cache/rm-safe
echo This command is always recursive!
echo '-v verbose, --clear delete cache permanently'
echo 'Delete files by moving to a safe in your ~/.cache/rm-safe
This command is always recursive!
-v verbose
--clear delete safe permanently
--status view safe sizes
'
exit
}
function clearsafe() {
test -d "$SAFELOC" && rm-progress -f "$SAFELOC"
exit
}
function viewsafe() {
test -d "$SAFELOC" && {
for d in "$SAFELOC"/*; do
printf "%s\t" "$d"
fastdu -h -s "$d"
done
}
exit
}
SAFELOC=~/.cache/rm-safe
FOLDERS=()
QUIET="-q"
@@ -20,6 +33,7 @@ for ((i=1; i<=${#@}; i++)) {
[[ "${!i}" = "--help" ]] && helpexit
[[ "${!i}" = "-v" ]] && { VERBOSE=1; QUIET=""; continue; }
[[ "${!i}" = "--clear" ]] && { clearsafe; continue; }
[[ "${!i}" = "--status" ]] && { viewsafe; continue; }
[[ "${!i}" = "-"* ]] && helpexit
FOLDERS+=( "${!i}" )
}