Files
yait/tools/Cleanup
2025-11-04 21:34:45 -05:00

56 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
me=$0
scriptversion="1.0.0"
version="$me $scriptversion
Copyright (C) 2025 GCK.
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."
usage="\
Usage: $me [OPTION]...
Standard GCK cleanup
Options:
-q, --quiet silence output
--help print this help and exit
--version output version information"
QUIET=
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--quiet|-q) QUIET="--quiet";;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information.'$1'." >&2
exit 1;;
esac
shift
done
fatal() {
echo "fatal: $*" >&2
exit 1
}
run() {
"$@" || fatal "could not run: $*"
}
[ -d "./git" ] && fatal "must be run from parent directory"
run sh ./tools/format $QUIET
run rm -rf .cache
run rm -f compile_commands.json
run make distclean
if [ -z "$QUIET" ]; then
echo "done."
fi