diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-03-01 11:08:46 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-03-01 11:08:46 +0100 |
commit | 06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1 (patch) | |
tree | d85b7917474f09851909e2aec01f7a8cd2368613 /tprint | |
parent | 336ae3a2843f3e764f41f650ef6d1361698ae359 (diff) | |
download | thermoprint-06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1.tar thermoprint-06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1.tar.gz thermoprint-06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1.tar.bz2 thermoprint-06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1.tar.xz thermoprint-06f2c2cc635b3598e060cb2fd88b95fc0f4c34b1.zip |
deletion & dry-run
Diffstat (limited to 'tprint')
-rw-r--r-- | tprint/src/Main.hs | 7 |
1 files changed, 5 insertions, 2 deletions
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 | |||
102 | | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p | 102 | | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p |
103 | | otherwise <- output = T.hPutStrLn out =<< either throwM return (cobbcode p) | 103 | | otherwise <- output = T.hPutStrLn out =<< either throwM return (cobbcode p) |
104 | 104 | ||
105 | tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withInput input $ \inH -> do | 105 | tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} _ = withInput input $ \inH -> do |
106 | let | 106 | let |
107 | p' | 107 | p' |
108 | | (BBCode, _) <- input = either throwM return . bbcode =<< T.hGetContents inH | 108 | | (BBCode, _) <- input = either throwM return . bbcode =<< T.hGetContents inH |
@@ -110,7 +110,10 @@ tprint TPrint{ operation = JobCreate{..}, ..} client@Client{..} out = withInput | |||
110 | block' | 110 | block' |
111 | | block = blockLoop client | 111 | | block = blockLoop client |
112 | | otherwise = const $ return () | 112 | | otherwise = const $ return () |
113 | block' =<< jobCreate printer . force =<< p' | 113 | p <- force <$> p' |
114 | unless dryRun $ block' =<< jobCreate printer p | ||
115 | |||
116 | tprint TPrint{ operation = JobDelete{..}, ..} Client{..} _ = unless dryRun $ jobDelete jobId | ||
114 | 117 | ||
115 | 118 | ||
116 | tprint _ _ _ = undefined | 119 | tprint _ _ _ = undefined |