summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/Weather.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Weather.hs')
-rw-r--r--src/Xmobar/Plugins/Monitors/Weather.hs16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Weather.hs b/src/Xmobar/Plugins/Monitors/Weather.hs
index b2a3dd4..07d8cc4 100644
--- a/src/Xmobar/Plugins/Monitors/Weather.hs
+++ b/src/Xmobar/Plugins/Monitors/Weather.hs
@@ -26,12 +26,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
import Data.Char (toLower)
import Text.ParserCombinators.Parsec
-import System.Console.GetOpt
- ( ArgDescr(ReqArg)
- , ArgOrder(Permute)
- , OptDescr(Option)
- , getOpt
- )
+import System.Console.GetOpt (ArgDescr(ReqArg), OptDescr(Option))
-- | Options the user may specify.
@@ -51,13 +46,6 @@ options =
[ Option "w" ["weathers"] (ReqArg (\s o -> o { weatherString = s }) "") ""
]
--- | Try to parse arguments from the config file and apply them.
-parseOpts :: [String] -> IO WeatherOpts
-parseOpts argv =
- case getOpt Permute options argv of
- (o, _, [] ) -> return $ foldr id defaultOpts o
- (_, _, errs) -> ioError . userError $ concat errs
-
weatherConfig :: IO MConfig
weatherConfig = mkMConfig
"<station>: <tempC>C, rh <rh>% (<hour>)" -- template
@@ -260,7 +248,7 @@ runWeather = runWeather' []
runWeather' :: [(String, String)] -> [String] -> Monitor String
runWeather' sks args =
do d <- io $ getData $ head args
- o <- io $ parseOpts args
+ o <- io $ parseOptsWith options defaultOpts args
i <- io $ runP parseData d
formatWeather o sks i