From 5678c7e8f9e57b1d452b66fac0e1b5f0eb7d02ed Mon Sep 17 00:00:00 2001 From: q Date: Fri, 12 Apr 2019 11:01:52 +0300 Subject: [PATCH] safe status --- files/rm-safe | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/files/rm-safe b/files/rm-safe index e944574..786db5a 100755 --- a/files/rm-safe +++ b/files/rm-safe @@ -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}" ) }