Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (56 sloc) 1.544 kB
9c44671 @sramsay Added license headers to all files.
authored
1 /*
2 * lookup.go
3 *
4 * This file is part of wu. It contains functions related to
5 * the -lookup switch (station lookup).
6 *
7 * Written and maintained by Stephen Ramsay <sramsay.unl@gmail.com>
8 * and Anthony Starks.
9 *
583b495 @sramsay Leveled package structure (to main).
authored
10 * Last Modified: Sat Apr 21 14:39:18 CDT 2012
9c44671 @sramsay Added license headers to all files.
authored
11 *
12 * Copyright © 2010-2011 by Stephen Ramsay and Anthony Starks.
13 *
14 * wu is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3, or (at your option)
17 * any later version.
18 *
19 * wu is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 * License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with wu; see the file COPYING. If not see
26 * <http://www.gnu.org/licenses/>.
27 */
28
a385f01 @sramsay Reorganizing files.
authored
29 package main
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
30
31 import "fmt"
32
33 type Lookup struct {
0156002 @sramsay Reformatted code.
authored
34 Location SLocation
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
35 }
36
37 type SLocation struct {
0156002 @sramsay Reformatted code.
authored
38 Nearby_weather_stations Nearby_weather_stations
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
39 }
40
41 type Nearby_weather_stations struct {
0156002 @sramsay Reformatted code.
authored
42 Airport Airport
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
43 }
44
45 type Airport struct {
0156002 @sramsay Reformatted code.
authored
46 Station []Station
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
47 }
48
49 type Station struct {
0156002 @sramsay Reformatted code.
authored
50 City string
51 Icao string
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
52 }
53
54 // printLookup prints nearby stations
55 func PrintLookup(obs *Lookup) {
0156002 @sramsay Reformatted code.
authored
56 station := obs.Location.Nearby_weather_stations.Airport.Station
57 if len(station) == 0 {
58 fmt.Println("No area stations")
59 } else {
60 for _, s := range station {
61 fmt.Printf("%s: %s\n", s.City, s.Icao)
62 }
63 }
c99a95f @sramsay Refactored structs and print statements into separate imported
authored
64 }
Something went wrong with that request. Please try again.