2023-09-21 14:51:08 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
function cleanup_dir() {
|
2023-10-06 19:18:37 -07:00
|
|
|
# NOTE(crag): for developers that want to always clean up .json outputs, etc., set
|
2023-11-15 22:28:04 -08:00
|
|
|
# export UNSTRUCTURED_CLEANUP_DEV_FIXTURES=1
|
|
|
|
if [ "$CI" != "true" ] && \
|
|
|
|
[ -n "$UNSTRUCTURED_CLEANUP_DEV_FIXTURES" ] && \
|
|
|
|
[ "$UNSTRUCTURED_CLEANUP_DEV_FIXTURES" != "0" ] ; then
|
2023-10-06 19:18:37 -07:00
|
|
|
return 0
|
|
|
|
fi
|
2023-09-21 14:51:08 -04:00
|
|
|
local dir_to_cleanup="${1}"
|
|
|
|
echo "--- Running cleanup of $dir_to_cleanup ---"
|
|
|
|
|
|
|
|
if [ -d "$dir_to_cleanup" ]; then
|
|
|
|
echo "cleaning up directory: $dir_to_cleanup"
|
|
|
|
rm -rf "$dir_to_cleanup"
|
|
|
|
else
|
|
|
|
echo "$dir_to_cleanup does not exist or is not a directory, skipping deletion"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "--- Cleanup done ---"
|
|
|
|
}
|