summaryrefslogtreecommitdiffstats
path: root/Notmuch.hs
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-25 03:43:49 +0100
committertv <tv@shackspace.de>2014-12-25 03:43:49 +0100
commit2054ab9a2d9fe4b3ea3890078a16d85a4d02aa4e (patch)
treeadf3f5b4fbdc48828ee32fd6ca0af8cbe48240bb /Notmuch.hs
parenta56c3aa47d78764ecd6eadfa249c5fc8b0a83346 (diff)
add TVSearch{,Result}
Diffstat (limited to 'Notmuch.hs')
-rw-r--r--Notmuch.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/Notmuch.hs b/Notmuch.hs
index 7ff6a92..c2c0b34 100644
--- a/Notmuch.hs
+++ b/Notmuch.hs
@@ -89,15 +89,14 @@ notmuch args = do
-- BS.hGetContents hout
-search :: String -> IO ()
-search term = do
- c <- notmuch [ "search", "--format=json", "--format-version=2", term ]
+search :: String -> IO (Either String [SearchResult])
+search term =
+ notmuch [ "search", "--format=json", "--format-version=2", term ]
+ >>= return . eitherDecode'
- let results = case eitherDecode' c :: Either String [SearchResult] of
- Left err -> error err
- Right x -> x
- mapM_ (T.putStrLn . drawSearchResult) results
+putSearchResults :: [SearchResult] -> IO ()
+putSearchResults = mapM_ (T.putStrLn . drawSearchResult)
showThread :: String -> IO ()