From 06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 1 Mar 2016 11:08:46 +0100 Subject: deletion & dry-run --- tprint/src/Main.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tprint/src/Main.hs') diff --git a/tprint/src/Main.hs b/tprint/src/Main.hs index 7c60d0d..f78349e 100644 --- a/tprint/src/Main.hs +++ b/tprint/src/Main.hs @@ -102,7 +102,7 @@ tprint TPrint{ operation = Job{..}, ..} Client{..} out = job jobId >>= format | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p | otherwise <- output = T.hPutStrLn out =<< either throwM return (cobbcode p) -tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withInput input $ \inH -> do +tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} _ = withInput input $ \inH -> do let p' | (BBCode, _) <- input = either throwM return . bbcode =<< T.hGetContents inH @@ -110,7 +110,10 @@ tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withInput block' | block = blockLoop client | otherwise = const $ return () - block' =<< jobCreate printer . force =<< p' + p <- force <$> p' + unless dryRun $ block' =<< jobCreate printer p + +tprint TPrint{ operation = JobDelete{..}, ..} Client{..} _ = unless dryRun $ jobDelete jobId tprint _ _ _ = undefined -- cgit v1.2.3