diff options
author | davidovski <david@davidovski.xyz> | 2022-03-03 19:12:05 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-03-03 19:12:05 +0000 |
commit | 4e244fa843a2cb53a137dede7caa304422e13f5c (patch) | |
tree | 0cd66079a30b31aa71a358e9db69b6d976628261 /src | |
parent | 6bc227cbffd0caa08d382f56df48cbb34f2afc59 (diff) |
added cache cleaningv1.1.0
Diffstat (limited to 'src')
-rw-r--r-- | src/remove.sh | 12 | ||||
-rwxr-xr-x | src/xi.sh | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/remove.sh b/src/remove.sh index 67bbbdd..7bbb889 100644 --- a/src/remove.sh +++ b/src/remove.sh @@ -39,10 +39,20 @@ remove () { removed=$((removed+1)) ${QUIET} || hbar ${HBAR_RED} -T "removing files" $removed $total done - ${QUIET} || hbar -t ${HBAR_COMPLETE} -T "removing files" $removed $total + ${QUIET} || hbar -t ${HBAR_COMPLETE} -T "removed files" $removed $total else ${QUIET} || printf "${LIGHT_BLACK}Action cancled by user\n" fi } +clean () { + set -- $(du -sh ${CACHE_DIR}) + + if prompt_question "${LIGHT_RED}Remove ${RED}$1${LIGHT_RED} of cached files?"; then + rm -rf ${CACHE_DIR}/* + ${QUIET} || printf "${GREEN}Cleared package cache!\n" + else + ${QUIET} || printf "${LIGHT_BLACK}Action cancled by user\n" + fi +} @@ -38,6 +38,8 @@ Available Commands: download a .xipkg file keyimport [name] [url] import a key from a url + clean + clean cached files and data search [query] search the database for a package @@ -153,6 +155,11 @@ else set -o noglob keyimport $@ ;; + "clean") + shift + . ${LIBDIR}/remove.sh + clean $@ + ;; "list") list ;; |