Created
November 7, 2019 05:57
-
-
Save ahmetb/9d0fd384adfdaf816036d6f687798bb5 to your computer and use it in GitHub Desktop.
list all files in archives hosted in a krew-index (run from repo root)
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
#!/bin/bash | |
set -euo pipefail | |
files=$( grep -hRE '\.(tar\.gz|zip)' plugins/* | \ | |
sed -E 's/^\s+(-\ )?uri:\s//g' | \ | |
sed -E 's/"//g' | \ | |
sort | \ | |
uniq ) | |
for f in $files; do | |
if [[ "$f" = *.tar.gz ]]; then | |
curl -sSLf "$f" | tar tzvf - | |
echo | |
elif [[ "$f" = *.zip ]]; then | |
tmp="$(mktemp).zip" | |
curl -sSLf "$f" > "$tmp" | |
trap 'rm -- "$tmp"' EXIT | |
unzip -Z1 "$tmp" | |
else | |
echo "UNKNOWN ARCHIVE: $f" >&2 | |
fi | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment