diff options
-rw-r--r-- | test10.hs | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/test10.hs b/test10.hs deleted file mode 100644 index 4889a59..0000000 --- a/test10.hs +++ /dev/null @@ -1,44 +0,0 @@ -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} - ---module Main (main) where - -import Control.Applicative -import qualified Data.Text.Lazy as LT -import qualified Data.Tree as Tree -import MBox (MBox) -import qualified MBox -import System.Environment -import System.Process - - -notmuchShowMBox :: String -> IO MBox -notmuchShowMBox searchTerm = - MBox.parseMBox . LT.pack <$> readProcess - "notmuch" - [ "show" - , "--format=mbox" - , "--entire-thread=true" - , searchTerm - ] - "" - - -renderMessage :: MBox.Message -> String -renderMessage msg = - LT.unpack (MBox.getMessageId $ MBox.headers msg) - ++ " " - ++ drop (length ("From " :: String)) (LT.unpack $ MBox.fromLine msg) - - -main :: IO () -main = do - -- load-env hack - maybe (return ()) (setEnv "HOME") =<< lookupEnv "OLDHOME" - - notmuchShowMBox "tree1" >>= - putStrLn . Tree.drawTree . - Tree.Node "subject:tree-test" . - map (fmap renderMessage) . - MBox.toForest |