improve output messages
This commit is contained in:
parent
cc0dfcde80
commit
dbd2a5be2b
15
src/Main.hs
15
src/Main.hs
@ -19,12 +19,19 @@ nameCheck uri = do
|
|||||||
case names of
|
case names of
|
||||||
Left error -> putStrLn ("Name check failed. "++error)
|
Left error -> putStrLn ("Name check failed. "++error)
|
||||||
Right names -> do
|
Right names -> do
|
||||||
|
putStrLn ("Found "++show (length names)++" names:")
|
||||||
|
mapM (\i -> putStrLn $ " - "++name i) names
|
||||||
|
|
||||||
let expiring = filter isExpiring names
|
let expiring = filter isExpiring names
|
||||||
total = length expiring
|
total = length expiring
|
||||||
failed <- sum <$> mapM (nameUpdate uri) expiring
|
if (total > 0) then do
|
||||||
if failed == 0
|
putStrLn (show total++" names are expiring")
|
||||||
then putStrLn "Names updated: all ok."
|
failed <- sum <$> mapM (nameUpdate uri) expiring
|
||||||
else putStrLn (show failed ++ "/" ++ show total ++ " failed.")
|
if failed == 0
|
||||||
|
then putStrLn "All names updated."
|
||||||
|
else putStrLn (show failed ++ "/" ++ show total ++ " failed.")
|
||||||
|
else
|
||||||
|
putStrLn "Nothing to update."
|
||||||
|
|
||||||
-- | Main function
|
-- | Main function
|
||||||
--
|
--
|
||||||
|
@ -152,4 +152,4 @@ nameUpdate uri (Name {..}) = do
|
|||||||
req <- rpcRequest uri "name_update" [ name, value ]
|
req <- rpcRequest uri "name_update" [ name, value ]
|
||||||
case req of
|
case req of
|
||||||
Left err -> putStrLn "failed" >> putStrLn err >> return 1
|
Left err -> putStrLn "failed" >> putStrLn err >> return 1
|
||||||
Right _ -> putStrLn "ok" >> return 1
|
Right _ -> putStrLn "ok" >> return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user