#! /usr/bin/env bash

platforms=(x86_64-linux arm-linux arm-android x86_64-macos x86_64-freebsd)

function infoToStatusImageURL() {
	local imageProvidingURL
	local action status platform
	local os
	local url

	action="$1"
	status="$2"
	platform="$3"

	os="$(echo "${platform}" | cut -f 2 -d -)"

	imageProvidingURL='https://rkeene.org/images/icons/dynamic-status/'
	url="${imageProvidingURL}/?os=${os}&status=${status}&action=${action}"

	echo "${url}"
}
for action in build tests; do
	for status in pass fail; do
		for platform in "${platforms[@]}"; do
			tag="${action}-${status}-${platform}"
cat << _EOF_
.timelineTableCell a[href*="/timeline?r=${tag}&"] {
  background: url("$(infoToStatusImageURL "${action}" "${status}" "${platform}")");
  width: 56px; 
  height: 20px;
  background-size: 56px 20px;
  background-repeat: no-repeat;
  color: rgba(0,0,0,0);
  display: inline-block;
  text-indent: -65536px;
}
_EOF_
		done
	done
done
exit 0

