@hackage / simple-prompt

Simple commandline text prompt functions

Latest0.2.4

About

Metadata

  • Last updated , by JensPetersen
  • License BSD-3-Clause
  • Categories Systems Programming
  • Maintained by: Jens Petersen <juhpetersen@gmail.com>

  • Lottery factor: 1

Links

Installation

Tested Compilers

  1. 9.12.2
  2. 9.10.3
  3. 9.8.4
  4. 9.6.7
  5. 9.4.8
  6. 9.2.8
  7. 9.0.2
  8. 8.10.7
  9. 8.8.4
  10. 8.6.5

Readme

simple-prompt

A simple commandline text prompt library for user input.

The SimplePrompt module provides:

  • prompt: returns a string
  • promptNonEmpty prompts for non-empty string
  • promptInitial with pre-filled initial input
  • promptPassword prompts for password
  • 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]

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