aboutsummaryrefslogtreecommitdiff
path: root/tprint
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-03-01 10:20:31 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2016-03-01 10:20:31 +0100
commitf52ec2c8694b2e0ec4bce4c533cb930b68adf00b (patch)
treecb937bb38fe1c0b0857d8204821dcddff661e68b /tprint
parent1095c5fb127e5db2313ef2edddee0626c72ce648 (diff)
downloadthermoprint-f52ec2c8694b2e0ec4bce4c533cb930b68adf00b.tar
thermoprint-f52ec2c8694b2e0ec4bce4c533cb930b68adf00b.tar.gz
thermoprint-f52ec2c8694b2e0ec4bce4c533cb930b68adf00b.tar.bz2
thermoprint-f52ec2c8694b2e0ec4bce4c533cb930b68adf00b.tar.xz
thermoprint-f52ec2c8694b2e0ec4bce4c533cb930b68adf00b.zip
drafts
Diffstat (limited to 'tprint')
-rw-r--r--tprint/src/Main.hs7
1 files changed, 7 insertions, 0 deletions
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
14import Data.Foldable 14import Data.Foldable
15import Data.List 15import Data.List
16import Data.Monoid 16import Data.Monoid
17import Data.Maybe
17 18
18import Control.Monad 19import Control.Monad
19 20
@@ -61,5 +62,11 @@ tprint TPrint{ operation = Jobs{..}, ..} Client{..} out = jobs printer jobRange
61 humanStatus (Done) _ = "finished successfully" 62 humanStatus (Done) _ = "finished successfully"
62 humanStatus (Failed err) _ = "failed: " ++ show err 63 humanStatus (Failed err) _ = "failed: " ++ show err
63 64
65tprint TPrint{ operation = Drafts, ..} Client{..} out = drafts >>= format
66 where format ds
67 | (Human, _) <- output = mapM_ (\(DraftId n, fromMaybe "" . fmap T.unpack -> t) -> hPutStrLn out $ show n ++ "\t" ++ t) $ Map.toAscList ds
68 | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty ds
69 | otherwise = hPutStrLn out . dumpStr $ Map.toAscList ds
70
64 71
65tprint _ _ _ = undefined 72tprint _ _ _ = undefined