-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from grafana/examples
docs: added awesome k6 list generator exampe
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
appname=awesome-k6-extensions | ||
|
||
TEMP=$(getopt -o 'n:h' --long 'stars:,help' -n $appname -- "$@") | ||
|
||
stars=15 | ||
|
||
usage() { | ||
cat >&2 <<EOF | ||
Create awesome k6 extension list based on registry. | ||
Usage: | ||
$appname [flags] | ||
Flags: | ||
-n, --stars num minimum number of stars for community extensions (default $stars) | ||
-h, --help print usage | ||
EOF | ||
} | ||
|
||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
eval set -- "$TEMP" | ||
unset TEMP | ||
|
||
while true; do | ||
case "$1" in | ||
'-n'|'--stars') | ||
stars=$2 | ||
shift 2 | ||
continue | ||
;; | ||
'-h'|'--help') | ||
usage | ||
exit 0 | ||
;; | ||
'--') | ||
shift | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
curl -s https://grafana.github.io/k6-extension-registry/registry.json | | ||
jq --argjson stars $stars -r -f awesome-k6-extensions.jq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
map( | ||
select(.module != "go.k6.io/k6") | | ||
select( (.repo.stars >= $stars or .official)) | | ||
{ | ||
name:.repo.name, | ||
url: .repo.url, | ||
description: (if .description | endswith(".") then .description else .description + "." end), | ||
order: (if .official then 1 else 2 end), | ||
tier: (if .official then "Official" else "Community" end) | ||
} | ||
) | | ||
group_by(.order) | .[] | | ||
( | ||
["\n### \(.|first|.tier)\n"] + | ||
(sort_by(.name)| map("- [\(.name)](\(.url)) - \(.description)")) | ||
) | | ||
.[] | ||
|