From 83a51ef7d5b8b788a86b521d3ef421ebe068c197 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 1 Mar 2016 11:24:22 +0100 Subject: draft & cleanup --- tprint/src/Main.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 > tprint TPrint{ operation = Job{..}, ..} Client{..} out = job jobId >>= format where format p | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p - | otherwise <- output = T.hPutStrLn out =<< either throwM return (cobbcode p) + | otherwise = T.hPutStrLn out =<< either throwM return (cobbcode p) + +tprint TPrint{ operation = Draft{..}, ..} Client{..} out = draft draftId >>= format + where format d@(fromMaybe "" . fmap T.unpack -> t, p) + | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty d + | otherwise = do + hPutStrLn out t + hPutStrLn out "" + T.hPutStrLn out =<< either throwM return (cobbcode p) -- Mutate tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withPrintout input $ \p -> do -- cgit v1.2.3