allow confirmation with a single keystroke

This commit is contained in:
Jonathan Lamothe 2018-12-28 14:37:50 -05:00
parent e2c1453dcd
commit 0f83374060

View File

@ -39,9 +39,9 @@ import System.Console.HCL
( Request ( Request
, prompt , prompt
, reqAgree , reqAgree
, reqChar
, reqIf , reqIf
, reqMenu , reqMenu
, reqResp
, required , required
, runRequest , runRequest
) )
@ -87,6 +87,6 @@ tryReq :: Request a -> S.StateT s IO (Maybe a)
tryReq = lift . runRequest tryReq = lift . runRequest
confirm :: String -> Request Bool confirm :: String -> Request Bool
confirm x = required $ prompt (x ++ " (y/n): ") $ reqAgree Nothing reqResp confirm x = prompt (x ++ " (y/n): ") $ reqAgree Nothing $ fmap return reqChar
--jl --jl