Skip to content

Commit

Permalink
refactor: multiline JQ to format topics
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanouil committed May 4, 2024
1 parent 64804ef commit 2fc9de0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/make-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ while IFS=, read -r category repo; do
description="No description available"
fi
description=$(echo "${description}" | sed 's/^[[:space:]]*//')
topics=$(gh api "repos/${repo}/topics" --jq ".names | map(select(.) | sub(\"^quarto-\"; \"\")) | map(select(. | test(\"quarto|extension|^pub$\") | not))")
topics=$(gh api "repos/${repo}/topics" --jq ".names")
topics=$(echo "${topics}" | jq -r 'map(select(.) | sub("^quarto-"; "") | sub("-template[s]*"; "") | if test("filters$|formats$|journals$") then sub("s$"; "") else . end)')
topics=$(echo "${topics}" | jq -r 'map(select(. | test("quarto|extension|^pub$") | not))')
topics=$(echo "${topics}" | jq -r 'unique')
yaml_usage="\n \n \`\`\`sh\n quarto add ${repo}\n \`\`\`"
yaml_description="description: |\n ${description}${yaml_usage}"
yaml_type="type: [${category}]"
Expand Down

0 comments on commit 2fc9de0

Please sign in to comment.