#!/bin/sh

# simple script to read weather from airport code and return it for display in xmobar

weather=$(weather-report $1 -m --no-cache -n | \
				grep 	-e '\[' \
						-e 'Temp' | \
				sed 	-e 's/\[using result //' \
						-e 's/,.*\]//' \
						-e 's/Temp.*: //' \
						-e 's/ C//' \
						-e 's/   //')

readarray -t y <<< "$weather"

loc=${y[0]}
temp=${y[1]}

echo -e "<fc=#ff79c6>$loc <fc=#FFFFFF>$temp</fc><fn=1>\u00b0</fn>C</fc>"
