diff options
author | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-30 10:56:37 +0200 |
---|---|---|
committer | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-30 10:57:17 +0200 |
commit | 15646fa9e492ded6978620e8e17239c636cfbb16 (patch) | |
tree | 1ffc7904b467be04b85ee0000e901f3d33a2e9aa /src | |
parent | bc75dbe4a72210352c2b1c0983b35658d307dca5 (diff) |
kmein config: add saveAttachment action
Diffstat (limited to 'src')
-rw-r--r-- | src/Notmuch.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Notmuch.hs b/src/Notmuch.hs index f86bd3d..0781650 100644 --- a/src/Notmuch.hs +++ b/src/Notmuch.hs @@ -170,6 +170,16 @@ notmuchShow term = do either error id (eitherDecodeLenient' c') +notmuchShowPartRaw :: String -> Int -> IO (Either String LBS8.ByteString) +notmuchShowPartRaw term partId = do + (exitCode, out, err) <- + notmuch' [ "show", "--format=raw" + , "--part=" <> show partId + , term ] + return $ case exitCode of + ExitSuccess -> Right out + _ -> Left $ show exitCode <> ": " <> LBS8.unpack err + notmuchShowPart :: String -> Int -> IO (Either String MessagePart) notmuchShowPart term partId = do -- TODO handle partId == 0 and partId > N |