mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 20:42:09 +03:00
5b9916e34b
Fixes shellcheck errors in script/* Adds a couple trailing newlines. Adds `script/shellcheck-scripts` and associated CI machinery. Current set ultra-conservative, does not output warnings, only errors.
26 lines
489 B
Bash
Executable File
26 lines
489 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
echo "usage: $0 <MAX_SIZE_IN_GB>"
|
|
exit 1
|
|
fi
|
|
|
|
if ! [[ -d target ]]; then
|
|
echo "target directory does not exist yet"
|
|
exit 0
|
|
fi
|
|
|
|
max_size_gb=$1
|
|
|
|
current_size=$(du -s target | cut -f1)
|
|
current_size_gb=$(expr ${current_size} / 1024 / 1024)
|
|
|
|
echo "target directory size: ${current_size_gb}gb. max size: ${max_size_gb}gb"
|
|
|
|
if [[ ${current_size_gb} -gt ${max_size_gb} ]]; then
|
|
echo "clearing target directory"
|
|
rm -rf target
|
|
fi
|