#!/bin/sh -efu
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2007-2023  Alexey Gladkov <gladkov.alexey@gmail.com>

# shellcheck source=tools/mki-sh-functions
. "${0%/*}"/mki-sh-functions

target=
[ "$#" -eq 0 ] ||
	target="$1"

# shellcheck disable=SC2016
verbose "has started executing${target:+ for '${target##*/}'}."

[ -d "$cachedir" ] ||
	exit 0

if [ -z "$target" ]; then
	find "$cachedir/" -mindepth 1 -maxdepth 1 -execdir rm -rf -- '{}' '+'
else
	rm -rf -- "${cachedir:?}/$target"
fi
