summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Mail.hs
diff options
context:
space:
mode:
authorslotThe <soliditsallgood@tuta.io>2020-01-04 21:20:56 +0100
committerjao <jao@gnu.org>2020-01-04 21:21:40 +0000
commit940be3bb32ed1f11c46ede98d51516998b17e128 (patch)
tree6d0c942c10efc64514dd419f746f631aec19c935 /src/Xmobar/Plugins/Mail.hs
parent2ec513d2e193998958ad5bf4a5f7280f595792e9 (diff)
downloadxmobar-940be3bb32ed1f11c46ede98d51516998b17e128.tar.gz
xmobar-940be3bb32ed1f11c46ede98d51516998b17e128.tar.bz2
Replace parseOpts with a generic function
Diffstat (limited to 'src/Xmobar/Plugins/Mail.hs')
-rw-r--r--src/Xmobar/Plugins/Mail.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Xmobar/Plugins/Mail.hs b/src/Xmobar/Plugins/Mail.hs
index ee4a119..36e85b8 100644
--- a/src/Xmobar/Plugins/Mail.hs
+++ b/src/Xmobar/Plugins/Mail.hs
@@ -18,6 +18,7 @@ module Xmobar.Plugins.Mail(Mail(..),MailX(..)) where
import Xmobar.Run.Exec
#ifdef INOTIFY
+import Xmobar.Plugins.Monitors.Common (parseOptsWith)
import Xmobar.System.Utils (expandHome, changeLoop)
import Control.Monad
@@ -64,13 +65,6 @@ options =
, Option "s" ["suffix"] (ReqArg (\x o -> o { oSuffix = x }) "") ""
]
-parseOptions :: [String] -> IO MOptions
-parseOptions args =
- case getOpt Permute options args of
- (o, _, []) -> return $ foldr id defaults o
- (_, _, errs) -> ioError . userError $ concat errs
-
-
-- | A list of mail box names and paths to maildirs.
data Mail = Mail [(String, FilePath)] String
deriving (Read, Show)
@@ -92,7 +86,7 @@ instance Exec MailX where
#else
start (MailX ms args _) cb = do
vs <- mapM (const $ newTVarIO S.empty) ms
- opts <- parseOptions args
+ opts <- parseOptsWith options defaults args
let prefix = oPrefix opts
suffix = oSuffix opts
dir = oDir opts