3 # weather version 1.4, http://fungi.yuggoth.org/weather/
4 # Copyright (c) 2006-2008 Jeremy Stanley <fungi@yuggoth.org>.
5 # Permission to use, copy, modify, and distribute this software is
6 # granted under terms provided in the LICENSE file distributed with
9 """Wrapper utility using the weather.py module."""
11 # added so distributors can consistently specify a private module location
12 private_module_path = None
13 if private_module_path:
15 sys.path.insert(1, private_module_path)
19 # initialize options and configs
20 selections = weather.Selections()
22 get_bool = selections.get_bool
24 # this mode just lists the aliases defined in the config
25 if get_bool("list"): print weather.list_aliases(selections.config)
29 for argument in selections.arguments:
30 if get_bool("conditions", argument):
31 print weather.get_metar(
32 id=get("id", argument),
33 verbose=get_bool("verbose", argument),
34 quiet=get_bool("quiet", argument),
35 headers=get("headers", argument),
36 murl=get("murl", argument)
38 if not get_bool("conditions", argument) \
39 or get_bool("forecast", argument):
40 print weather.get_forecast(
41 city=get("city", argument),
42 st=get("st", argument),
43 verbose=get_bool("verbose", argument),
44 quiet=get_bool("quiet", argument),
45 flines=get("flines", argument),
46 furl=get("furl", argument)