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
|
||||
Left error -> putStrLn ("Name check failed. "++error)
|
||||
Right names -> do
|
||||
putStrLn ("Found "++show (length names)++" names:")
|
||||
mapM (\i -> putStrLn $ " - "++name i) names
|
||||
|
||||
let expiring = filter isExpiring names
|
||||
total = length expiring
|
||||
failed <- sum <$> mapM (nameUpdate uri) expiring
|
||||
if failed == 0
|
||||
then putStrLn "Names updated: all ok."
|
||||
else putStrLn (show failed ++ "/" ++ show total ++ " failed.")
|
||||
if (total > 0) then do
|
||||
putStrLn (show total++" names are expiring")
|
||||
failed <- sum <$> mapM (nameUpdate uri) expiring
|
||||
if failed == 0
|
||||
then putStrLn "All names updated."
|
||||
else putStrLn (show failed ++ "/" ++ show total ++ " failed.")
|
||||
else
|
||||
putStrLn "Nothing to update."
|
||||
|
||||
-- | Main function
|
||||
--
|
||||
|
@ -152,4 +152,4 @@ nameUpdate uri (Name {..}) = do
|
||||
req <- rpcRequest uri "name_update" [ name, value ]
|
||||
case req of
|
||||
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