From c2eba63d11c748aeebdd3a4a3a5b015ac5e2f2c9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 Aug 2016 16:59:25 -0400 Subject: add cost estimates --- UI/Readline.hs | 7 ++++--- UI/Zenity.hs | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'UI') diff --git a/UI/Readline.hs b/UI/Readline.hs index ac962d2..8a3c4ee 100644 --- a/UI/Readline.hs +++ b/UI/Readline.hs @@ -32,15 +32,16 @@ readlineUI = UI myShowError :: Desc -> IO () myShowError desc = do hPutStrLn stderr $ "Error: " ++ desc + putStrLn "" -myPromptQuestion :: Title -> Desc -> IO Bool -myPromptQuestion title desc = do +myPromptQuestion :: Title -> Desc -> Question -> IO Bool +myPromptQuestion title desc question = do showTitle title go where go = do putStrLn desc - mresp <- readline "y/n? " + mresp <- readline $ question ++ " [y/n] " case mresp of Just s | "y" `isPrefixOf` (map toLower s) -> diff --git a/UI/Zenity.hs b/UI/Zenity.hs index 3c3f313..b74631f 100644 --- a/UI/Zenity.hs +++ b/UI/Zenity.hs @@ -42,12 +42,12 @@ myShowError desc = bracket go cleanup (\_ -> return ()) _ <- waitZenity h return () -myPromptQuestion :: Title -> Desc -> IO Bool -myPromptQuestion title desc = do +myPromptQuestion :: Title -> Desc -> Question -> IO Bool +myPromptQuestion title desc question = do h <- runZenity [ "--question" , "--title", title - , "--text", desc + , "--text", desc ++ "\n" ++ question ] (_, ok) <- waitZenity h return ok -- cgit v1.2.3