darcs-2.12.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.Prompt

Contents

- User prompts

Synopsis

- askEnter :: String -> IO ()
- askUser :: String -> IO String
- askUserListItem :: String -> [String] -> IO String
- data PromptConfig = PromptConfig {
  - pPrompt :: String
  - pBasicCharacters :: [Char]
  - pAdvancedCharacters :: [Char]
  - pDefault :: Maybe Char
  - pHelp :: [Char]
  }
- promptYorn :: String -> IO Bool
- promptChar :: PromptConfig -> IO Char

# User prompts

askEnter #

Arguments

:: String | The prompt to display
-> IO () |

Ask the user to press Enter

askUser #

Arguments

:: String | The prompt to display
-> IO String | The string the user entered.

Ask the user for a line of input.

askUserListItem :: String -> [String] -> IO String #

`askUserListItem prompt xs` enumerates `xs` on the screen, allowing the user to choose one of the items

data PromptConfig #

Constructors

PromptConfig |
Fields pPrompt :: String pBasicCharacters :: [Char] pAdvancedCharacters :: [Char] only shown on help pDefault :: Maybe Char pHelp :: [Char]

promptYorn :: String -> IO Bool #

Prompt the user for a yes or no

promptChar :: PromptConfig -> IO Char #

Prompt the user for a character, among a list of possible ones. Always returns a lowercase character. This is because the default character (ie, the character shown in uppercase, that is automatically selected when the user presses the space bar) is shown as uppercase, hence users may want to enter it as uppercase.