forked from ajstarks/conditions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lookup.go
64 lines (56 loc) · 1.51 KB
/
lookup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* lookup.go
*
* This file is part of wu. It contains functions related to
* the -lookup switch (station lookup).
*
* Written and maintained by Stephen Ramsay <sramsay.unl@gmail.com>
* and Anthony Starks.
*
* Last Modified: Wed Dec 18 16:11:47 CST 2013
*
* Copyright © 2010-2014 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 Lookup struct {
Location SLocation
}
type SLocation struct {
Nearby_weather_stations Nearby_weather_stations
}
type Nearby_weather_stations struct {
Airport Airport
}
type Airport struct {
Station []Station
}
type Station struct {
City string
Icao string
}
// printLookup prints nearby stations
func PrintLookup(obs *Lookup) {
station := obs.Location.Nearby_weather_stations.Airport.Station
if len(station) == 0 {
fmt.Println("No area stations")
} else {
for _, s := range station {
fmt.Printf("%s: %s\n", s.City, s.Icao)
}
}
}