Last active
September 16, 2020 16:55
-
-
Save weibeld/51cd98ce465779d5e1eedc96bd2cb1d8 to your computer and use it in GitHub Desktop.
Download the official logo pack of a CNCF project from the CNCF Branding page (https://cncf-branding.netlify.app/)
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
usage() { | |
cat <<EOF | |
$(basename $0) - Download the official logo pack of a CNCF project | |
USAGE | |
$(basename $0) project [dir] | |
ARGUMENTS | |
project ID of the CNCF project on https://cncf-branding.netlify.app/ | |
dir Output directory (will be created if it doesn't exist). Default: . | |
EXAMPLE | |
$(basename $0) kubernetes logos/kubernetes | |
EOF | |
} | |
[[ "$#" -lt 1 || "$1" =~ ^-h$|^--help$ ]] && { usage; exit 1; } | |
project=$1 | |
dir=${2:-.} | |
base_url=https://cncf-branding.netlify.app | |
token_project=projects | |
token_logos=img/projects | |
tokens_type=(horizontal stacked icon) | |
tokens_color=(color black white) | |
if ! curl --fail "$base_url/$token_projects/$project" &>/dev/null; then | |
echo "Invalid project ID: $project" | |
echo "Check available project IDs on https://cncf-branding.netlify.app/" | |
exit 1 | |
fi | |
for type in "${tokens_type[@]}"; do | |
for color in "${tokens_color[@]}"; do | |
file=$project-$type-$color.svg | |
echo "Downloading $file..." | |
wget -q -P "$dir" "$base_url/$token_logos/$project/$type/$color/$file" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment