the weather zsh terminal function

get a weather report in terminal

Dec 2, 2020

While I was kind of digging through my configuration files to make the post what i use, I went down a bit of a rabbit hole for my zsh configuration.

I had a bunch of aliases, functions, and plugins in my configuration that I didn’t use anymore, and didn’t need really, so I started to go through them and began looking into which ones were still useful vs which ones I could remove from my .zshrc file.

During that process I stumbled upon the freekmurze/dotfiles repo, and I found this function that freek is sourcing in his .zshrc

function weather() {
   city="$1"

   if [ -z "$city" ]; then
      city="Antwerp"
   fi

   eval "curl http://wttr.in/${city}"
}

So this function if you open up your terminal, you simply type weather and the weather report comes up beautifully.

I adjusted it slightly so it runs for Peterborough instead of Antwerp, but here is the output.