From f52ec2c8694b2e0ec4bce4c533cb930b68adf00b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 1 Mar 2016 10:20:31 +0100 Subject: drafts --- tprint/src/Main.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tprint/src/Main.hs') diff --git a/tprint/src/Main.hs b/tprint/src/Main.hs index ce4df20..44cc2f6 100644 --- a/tprint/src/Main.hs +++ b/tprint/src/Main.hs @@ -14,6 +14,7 @@ import Data.Time import Data.Foldable import Data.List import Data.Monoid +import Data.Maybe import Control.Monad @@ -61,5 +62,11 @@ tprint TPrint{ operation = Jobs{..}, ..} Client{..} out = jobs printer jobRange humanStatus (Done) _ = "finished successfully" humanStatus (Failed err) _ = "failed: " ++ show err +tprint TPrint{ operation = Drafts, ..} Client{..} out = drafts >>= format + where format ds + | (Human, _) <- output = mapM_ (\(DraftId n, fromMaybe "" . fmap T.unpack -> t) -> hPutStrLn out $ show n ++ "\t" ++ t) $ Map.toAscList ds + | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty ds + | otherwise = hPutStrLn out . dumpStr $ Map.toAscList ds + tprint _ _ _ = undefined -- cgit v1.2.3