diff options
Diffstat (limited to 'UI/NonInteractive.hs')
-rw-r--r-- | UI/NonInteractive.hs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/UI/NonInteractive.hs b/UI/NonInteractive.hs index f0010eb..cd96254 100644 --- a/UI/NonInteractive.hs +++ b/UI/NonInteractive.hs @@ -6,7 +6,7 @@ module UI.NonInteractive (noninteractiveUI) where import Types.UI -import System.IO +import Output import Control.Exception noninteractiveUI :: UI @@ -22,21 +22,19 @@ noninteractiveUI = UI } myShowError :: Desc -> IO () -myShowError desc = hPutStrLn stderr $ "Error: " ++ desc +myShowError desc = warn $ "Error: " ++ desc myShowInfo :: Title -> Desc -> IO () -myShowInfo _title desc = putStrLn desc +myShowInfo _title desc = say desc myPrompt :: Title -> Desc -> x -> IO a myPrompt _title desc _ = do - putStrLn desc + say desc error "Not running at a terminal and zenity is not installed; cannot interact with user." myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a myWithProgress _title desc a = bracket_ setup cleanup (a sendpercent) where - setup = putStrLn desc - sendpercent p = do - putStr (show p ++ "% ") - hFlush stdout - cleanup = putStrLn "done" + setup = say desc + sendpercent p = progress (show p ++ "% ") + cleanup = say "done" |