Skip to content

Commit db8ad06

Browse files
committed
Clean up whitespace and indentation
Signed-off-by: Jack Baldry <[email protected]>
1 parent 858f7e5 commit db8ad06

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

scripts/extension-registry-changed

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
#!/usr/bin/env bash
22

3-
# This script keeps the list of extensions up to date
3+
# This script keeps the list of extensions up to date
44
# in the docs/sources/next/extensions/explore.md file.
55
#
66
# The script is run by the extension-registry.changed.yml
77
# workflow when the extension registry changes.
8-
#
8+
#
99
# The list of extensions is generated based on https://registry.k6.io/registry.json.
1010
#
11-
# In the docs/sources/next/extensions/explore.md file
11+
# In the docs/sources/next/extensions/explore.md file
1212
# the content of the <div class="nav-cards"> HTML element
1313
# is replaced with the generated extension list.
1414

15+
set -euf -o pipefail
16+
1517
generate_extension_list_partial() {
16-
curl -sL https://registry.k6.io/registry.json |
17-
jq -r '
18+
curl -sL https://registry.k6.io/registry.json |
19+
jq -r '
1820
map(select(.module != "go.k6.io/k6") | { name:.repo.name, url: .repo.url, description: .description } ) |
1921
sort_by(.name) | map(
2022
" <a href=\"\(.url)\" target=\"_blank\" class=\"nav-cards__item nav-cards__item--guide\">
2123
<h4>\(.name)</h4>
2224
<p>\(.description)</p>
2325
</a>"
24-
) | .[]
26+
) | .[]
2527
'
2628
}
2729

2830
replace_extension_list_partial() {
29-
local -r outfile="$1"
30-
local -r infile="$2"
31+
local -r outfile="$1"
32+
local -r infile="$2"
3133

32-
ed -s "$outfile" <<EOF
34+
ed -s "$outfile" <<EOF
3335
/<div class=.nav-cards.>/+,/<.div>/-d
3436
/<div class=.nav-cards.>/ r $infile
3537
w
@@ -40,7 +42,7 @@ EOF
4042
scriptdir="$(dirname "$(readlink -f "$0")")"
4143
docfile="$scriptdir/../docs/sources/next/extensions/explore.md"
4244

43-
tmpfile="$(mktemp)"
45+
tmpfile="$(mktemp /tmp/extension-registry-changed.XXXXXX)"
4446

4547
generate_extension_list_partial > "$tmpfile"
4648
replace_extension_list_partial "$docfile" "$tmpfile"

0 commit comments

Comments
 (0)