From 401acf7a66c6426b8764a9f996dbb762bcd0f438 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Mon, 18 Oct 2021 22:01:54 +0300 Subject: [PATCH] Add clean-cache script --- bin/clean-cache | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bin/clean-cache diff --git a/bin/clean-cache b/bin/clean-cache new file mode 100755 index 0000000..4a24e0b --- /dev/null +++ b/bin/clean-cache @@ -0,0 +1,25 @@ +#! /bin/bash + +args=("$@") + +usage() { + echo "Clean Cache utility: clean-cache [OPTIONS]" + echo + echo " --npm cleans npm cache by running 'npm cache clean -f'" + echo " --yarn cleans yarn cache by running 'yarn cache clean'" +} + +if [ $# -eq 0 ] ; then + usage + exit +fi + +if [[ "${args[@]}" =~ "--npm" ]] ; then + npm cache clean -f >> /dev/null 2>> /dev/null +fi + +if [[ "${args[@]}" =~ "--yarn" ]] ; then + yarn cache clean >> /dev/null 2>> /dev/null +fi + +# TODO: Clean yay's AUR cache