diff options
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index cc10782..1ca0a2c 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -1011,16 +1011,20 @@ logs :: Conduit.ConduitT () ByteString (Conduit.ResourceT IO) () -> IO ByteString logs ns src = - Conduit.runConduitRes - <| src - .| Conduit.iterM - ( ByteString.filter (/= BSI.c2w '\n') - .> (\t -> Log.fmt ["info", "bild", nschunk ns, decodeUtf8 t]) - .> Text.take 79 - .> (<> "…\r") - .> putStr - ) - .| Conduit.foldC + Env.lookupEnv "COLUMNS" + -- is there a better way to set a default? + /> maybe 79 (readMaybe .> fromMaybe 79) + +> \columns -> + src + .| Conduit.iterM + ( ByteString.filter (/= BSI.c2w '\n') + .> (\t -> Log.fmt ["info", "bild", nschunk ns, decodeUtf8 t]) + .> Text.take (columns - 1) + .> (<> "…\r") + .> putStr + ) + .| Conduit.foldC + |> Conduit.runConduitRes nschunk :: Namespace -> Text nschunk = Namespace.toPath .> Text.pack |