Skip to content

Commit 72d3c92

Browse files
authored
chore: format scripts (#440)
1 parent 6096a40 commit 72d3c92

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

release.sh

+30-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -euo pipefail
33

44
usage() {
5-
cat <<EOF
5+
cat << EOF
66
Usage: $0 [OPTIONS] [<MODULE> <VERSION>]
77
88
Create annotated git tags for module releases.
@@ -28,7 +28,7 @@ EOF
2828

2929
check_getopt() {
3030
# Check if we have GNU or BSD getopt.
31-
if getopt --test >/dev/null 2>&1; then
31+
if getopt --test > /dev/null 2>&1; then
3232
# Exit status 4 means GNU getopt is available.
3333
if [[ $? -ne 4 ]]; then
3434
echo "Error: GNU getopt is not available." >&2
@@ -50,10 +50,10 @@ maybe_dry_run() {
5050
}
5151

5252
get_readme_version() {
53-
grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" |
54-
head -1 |
55-
grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' ||
56-
echo "0.0.0"
53+
grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" \
54+
| head -1 \
55+
| grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' \
56+
|| echo "0.0.0"
5757
}
5858

5959
list_modules() {
@@ -131,29 +131,29 @@ eval set -- "$temp"
131131

132132
while true; do
133133
case "$1" in
134-
-l | --list)
135-
list=true
136-
shift
137-
;;
138-
-d | --dry-run)
139-
dry_run=true
140-
shift
141-
;;
142-
-p | --push)
143-
push=true
144-
shift
145-
;;
146-
-h | --help)
147-
usage
148-
;;
149-
--)
150-
shift
151-
break
152-
;;
153-
*)
154-
echo "Error: Internal error!" >&2
155-
exit 1
156-
;;
134+
-l | --list)
135+
list=true
136+
shift
137+
;;
138+
-d | --dry-run)
139+
dry_run=true
140+
shift
141+
;;
142+
-p | --push)
143+
push=true
144+
shift
145+
;;
146+
-h | --help)
147+
usage
148+
;;
149+
--)
150+
shift
151+
break
152+
;;
153+
*)
154+
echo "Error: Internal error!" >&2
155+
exit 1
156+
;;
157157
esac
158158
done
159159

@@ -178,7 +178,7 @@ if ! tag_name=$(get_tag_name "$module" "$version"); then
178178
exit 1
179179
fi
180180

181-
if git rev-parse -q --verify "refs/tags/$tag_name" >/dev/null 2>&1; then
181+
if git rev-parse -q --verify "refs/tags/$tag_name" > /dev/null 2>&1; then
182182
echo "Notice: Tag '$tag_name' already exists" >&2
183183
else
184184
maybe_dry_run git tag -a "$tag_name" -m "Release $module v$version"

update_version.sh

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -euo pipefail
33

44
usage() {
5-
cat <<EOF
5+
cat << EOF
66
Usage: $0 [OPTIONS] <MODULE> <VERSION>
77
88
Update or check the version in a module's README.md file.
@@ -63,14 +63,14 @@ update_version() {
6363
6464
print
6565
}
66-
' "$file" >"$tmpfile" && mv "$tmpfile" "$file"
66+
' "$file" > "$tmpfile" && mv "$tmpfile" "$file"
6767
}
6868

6969
get_readme_version() {
70-
grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" |
71-
head -1 |
72-
grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' ||
73-
echo "0.0.0"
70+
grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" \
71+
| head -1 \
72+
| grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' \
73+
|| echo "0.0.0"
7474
}
7575

7676
# Set defaults.
@@ -79,20 +79,20 @@ check_only=false
7979
# Parse command-line options.
8080
while [[ $# -gt 0 ]]; do
8181
case "$1" in
82-
-c | --check)
83-
check_only=true
84-
shift
85-
;;
86-
-h | --help)
87-
usage 0
88-
;;
89-
-*)
90-
echo "Error: Unknown option: $1" >&2
91-
usage 1
92-
;;
93-
*)
94-
break
95-
;;
82+
-c | --check)
83+
check_only=true
84+
shift
85+
;;
86+
-h | --help)
87+
usage 0
88+
;;
89+
-*)
90+
echo "Error: Unknown option: $1" >&2
91+
usage 1
92+
;;
93+
*)
94+
break
95+
;;
9696
esac
9797
done
9898

0 commit comments

Comments
 (0)