2021-06-19 19:55:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
has() {
|
|
|
|
if (( $# )); then
|
|
|
|
hash "$1" 2>/dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
is_a() {
|
|
|
|
if (( $# > 1 )); then
|
|
|
|
head -1 "$1" | grep -qE '^#!.*'"$2"'$'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
find . -name .DS_Store -exec rm -f -- {} +
|
|
|
|
|
|
|
|
git status -zu | while read -rd '' xy filename; do
|
|
|
|
if [[ $xy = "??" || $xy = D ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $filename = *.sh ]] || is_a "$filename" bash; then
|
2021-07-12 04:49:56 +00:00
|
|
|
if has shellcheck; then
|
|
|
|
grep -vq "declare -p" "$filename" && shellcheck -s bash "$filename"
|
2021-06-19 19:55:39 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|