3 # weather version 1.3, http://fungi.yuggoth.org/weather/
4 # Copyright (c) 2006 Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
5 # Licensed per terms in the LICENSE file distributed with this software.
7 """Wrapper utility using the weather.py module."""
9 # added so distributors can consistently specify a private module location
10 private_module_path = None
11 if private_module_path:
13 sys.path.insert(1, private_module_path)
17 # initialize options and configs
18 selections = weather.Selections()
20 get_bool = selections.get_bool
22 # this mode just lists the aliases defined in the config
23 if get_bool("list"): print weather.list_aliases(selections.config)
27 for argument in selections.arguments:
28 if get_bool("conditions", argument):
29 print weather.get_metar(
31 get_bool("verbose", argument)
33 if not get_bool("conditions", argument) \
34 or get_bool("forecast", argument):
35 print weather.get_forecast(
36 get("city", argument),
38 get_bool("verbose", argument)