Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9669a53d72
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (52 sloc) 1.554 kb
/*
* alerts.go
*
* This file is part of wu. It contains functions related to
* the -alerts switch (active weather alerts).
*
* Written and maintained by Stephen Ramsay <sramsay.unl@gmail.com>
* and Anthony Starks.
*
* Last Modified: Sat Apr 21 14:38:06 CDT 2012
*
* Copyright © 2010-2012 by Stephen Ramsay and Anthony Starks.
*
* wu is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* wu is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wu; see the file COPYING. If not see
* <http://www.gnu.org/licenses/>.
*/
package main
import (
"fmt"
)
type AlertConditions struct {
Alerts []Alerts
}
type Alerts struct {
Date string
Expires string
Description string
Message string
}
// printAlerts prints the alerts for a given station to standard out
func PrintAlerts(obs *AlertConditions, stationId string) {
if len(obs.Alerts) == 0 {
fmt.Println("No active alerts")
} else {
fmt.Printf("Station: %s\n", stationId)
for _, a := range obs.Alerts {
fmt.Printf("### %s ###\n\nIssued at %s\nExpires at %s\n%s\n",
a.Description, a.Date, a.Expires, a.Message)
}
}
}
Jump to Line
Something went wrong with that request. Please try again.