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