refactor(tools): fix shell check issues

This commit is contained in:
Cotes Chung 2023-02-16 05:02:22 +08:00
parent d0cf2a8dd5
commit 4490ce4107
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
2 changed files with 5 additions and 4 deletions

View File

@ -21,7 +21,7 @@ help() {
check_status() { check_status() {
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
echo "Error: Commit unstaged files first, and then run this tool again." echo "Error: Commit unstaged files first, and then run this tool again."
exit -1 exit 1
fi fi
} }
@ -33,7 +33,8 @@ check_init() {
else else
if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then
# on BSD, the `wc` could contains blank # on BSD, the `wc` could contains blank
local _count="$(find .github/workflows/ -type f -name "*.yml" | wc -l)" local _count
_count=$(find .github/workflows/ -type f -name "*.yml" | wc -l)
if [[ ${_count//[[:blank:]]/} == 1 ]]; then if [[ ${_count//[[:blank:]]/} == 1 ]]; then
_has_inited=true _has_inited=true
fi fi
@ -47,7 +48,7 @@ check_init() {
} }
checkout_latest_tag() { checkout_latest_tag() {
tag=$(git describe --tags $(git rev-list --tags --max-count=1)) tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
git reset --hard "$tag" git reset --hard "$tag"
} }

View File

@ -104,7 +104,7 @@ check() {
_bump_file() { _bump_file() {
for i in "${!FILES[@]}"; do for i in "${!FILES[@]}"; do
if [[ ${FILES[$i]} == $NODE_CONFIG ]]; then if [[ ${FILES[$i]} == "$NODE_CONFIG" ]]; then
continue continue
fi fi