aboutsummaryrefslogtreecommitdiff
path: root/tprint
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-03-01 11:24:22 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2016-03-01 11:24:22 +0100
commit83a51ef7d5b8b788a86b521d3ef421ebe068c197 (patch)
treec79402b48de06a3b6bbe8a57ab55d2b1c5848384 /tprint
parent874386a7f8fd113bf746e3f9747a07abe9f45b62 (diff)
downloadthermoprint-83a51ef7d5b8b788a86b521d3ef421ebe068c197.tar
thermoprint-83a51ef7d5b8b788a86b521d3ef421ebe068c197.tar.gz
thermoprint-83a51ef7d5b8b788a86b521d3ef421ebe068c197.tar.bz2
thermoprint-83a51ef7d5b8b788a86b521d3ef421ebe068c197.tar.xz
thermoprint-83a51ef7d5b8b788a86b521d3ef421ebe068c197.zip
draft & cleanup
Diffstat (limited to 'tprint')
-rw-r--r--tprint/src/Main.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/tprint/src/Main.hs b/tprint/src/Main.hs
index 8a534b8..5734e68 100644
--- a/tprint/src/Main.hs
+++ b/tprint/src/Main.hs
@@ -109,7 +109,15 @@ tprint TPrint{ operation = JobStatus{..}, ..} Client{..} out = jobStatus jobId >
109tprint TPrint{ operation = Job{..}, ..} Client{..} out = job jobId >>= format 109tprint TPrint{ operation = Job{..}, ..} Client{..} out = job jobId >>= format
110 where format p 110 where format p
111 | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p 111 | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p
112 | otherwise <- output = T.hPutStrLn out =<< either throwM return (cobbcode p) 112 | otherwise = T.hPutStrLn out =<< either throwM return (cobbcode p)
113
114tprint TPrint{ operation = Draft{..}, ..} Client{..} out = draft draftId >>= format
115 where format d@(fromMaybe "" . fmap T.unpack -> t, p)
116 | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty d
117 | otherwise = do
118 hPutStrLn out t
119 hPutStrLn out ""
120 T.hPutStrLn out =<< either throwM return (cobbcode p)
113 121
114-- Mutate 122-- Mutate
115tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withPrintout input $ \p -> do 123tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withPrintout input $ \p -> do