Description
Simple commandline text prompt functions.
Description
The library provides prompt functions for reading user input: for example prompt returns the input given, promptEnter expects only Enter, and yesNo asks for confirmation.
README.md
simple-prompt
A simple commandline text prompt library for user input.
The SimplePrompt module provides:
prompt: returns a stringpromptNonEmptyprompts for non-empty stringpromptInitialwith pre-filled initial inputpromptPasswordprompts for passwordpromptCharprompts for a characterpromptKeyPresswaits for a key presspromptEnterwaits for Enter keyyesNoexpects y/n answeryesNoDefault[y/N] or [Y/n]
It uses haskeline to read the input.
The SimplePrompt.Internal module provides lower-level access to functional haskeline InputT monad transformer-based prompt functions:
runPrompt,getPrompt*untilInput,mapInput,clearedInput,nonEmptyInput.
Usage examples
Since it basically runs in the IO monad usage is pretty simple.
For explicit examples search for import SimplePrompt in consumer packages: dl-fedora, fbrnch, hkgr, rhbzquery, select-rpms, stack-clean-old.