From 5c6124815130174f7f39aacc33451c8562abccf1 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Sep 2020 19:17:55 +0200 Subject: test10: RIP --- test10.hs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 test10.hs (limited to 'test10.hs') 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 -- cgit v1.2.3