simple-prompt 0.2.1 → 0.2.2
raw patch · 4 files changed
+16/−4 lines, 4 filesdep ~haskeline
Dependency ranges changed: haskeline
Files
- ChangeLog.md +3/−0
- README.md +2/−1
- simple-prompt.cabal +4/−3
- src/SimplePrompt.hs +7/−0
ChangeLog.md view
@@ -1,5 +1,8 @@ # Revision history for simple-prompt +## 0.2.2 (2023-10-27)+- add promptKeyPress+ ## 0.2.1 (2023-08-09) - do not trim spaces for yesNo and yesNoDefault - Internal: timedInput renamed to clearedInput
README.md view
@@ -8,7 +8,8 @@ - `promptNonEmpty` prompts for non-empty string - `promptInitial` with pre-filled initial input - `promptPassword` prompts for password-- `promptChar` prompt for a character+- `promptChar` prompts for a character+- `promptKeyPress` waits for a key press - `promptEnter` waits for Enter key - `yesNo` expects y/n answer - `yesNoDefault` [y/N] or [Y/n]
simple-prompt.cabal view
@@ -1,5 +1,5 @@ name: simple-prompt-version: 0.2.1+version: 0.2.2 synopsis: Simple commandline text prompt functions description: The library provides prompt functions for reading user input:@@ -24,7 +24,8 @@ || == 8.10.7 || == 9.0.2 || == 9.2.8- || == 9.4.5+ || == 9.4.7+ || == 9.6.3 source-repository head type: git@@ -34,7 +35,7 @@ build-depends: base < 5, exceptions, extra,- haskeline,+ haskeline > 0.8, time default-language: Haskell2010
src/SimplePrompt.hs view
@@ -6,6 +6,7 @@ promptBuffered, promptNonEmpty, promptChar,+ promptKeyPress, promptEnter, promptPassword, yesNo,@@ -14,6 +15,7 @@ import Control.Monad (void) import Data.List.Extra (lower)+import System.Console.Haskeline (waitForAnyKey) import SimplePrompt.Internal @@ -47,6 +49,11 @@ promptChar :: MONADCONSTRAINT => String -> m Char promptChar = runPrompt . clearedInput . getPromptChar++-- | prompt for key press (returns False if Ctrl-d or EOF)+promptKeyPress :: MONADCONSTRAINT => String -> m Bool+promptKeyPress =+ runPrompt . clearedInput . waitForAnyKey -- | prompt for Enter key promptEnter :: MONADCONSTRAINT => String -> m ()