1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-29 09:42:35 +03:00

Use logger in warnIfOutdated

This commit is contained in:
Nicolas Mattia 2019-11-27 14:35:24 +01:00
parent 50134f1aa6
commit a20bc9c85d

View File

@ -25,7 +25,6 @@ import qualified Data.ByteString.Lazy.Char8 as BL8
import qualified Data.Digest.Pure.MD5 as MD5
import qualified Data.HashMap.Strict as HMS
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified System.Directory as Dir
-------------------------------------------------------------------------------
@ -184,9 +183,9 @@ pathNixSourcesNix = "nix" </> "sources.nix"
warnIfOutdated :: IO ()
warnIfOutdated = do
tryAny (BL8.readFile pathNixSourcesNix) >>= \case
Left e -> T.putStrLn $ T.unlines -- warn with tsay
[ "Could not read " <> T.pack pathNixSourcesNix
, "Error: " <> tshow e
Left e -> tsay $ T.unlines -- warn with tsay
[ T.unwords [ tyellow "WARNING:", "Could not read" , T.pack pathNixSourcesNix ]
, T.unwords [ " ", "(", tshow e, ")" ]
]
Right content -> do
case md5ToSourcesVersion (T.pack $ show $ MD5.md5 content) of