simple-prompt

Simple commandline text prompt functions

https://github.com/juhp/simple-prompt

Version on this page:0.2.2
LTS Haskell 22.43:0.2.3
Stackage Nightly 2024-12-08:0.2.3
Latest on Hackage:0.2.3

See all snapshots simple-prompt appears in

BSD-3-Clause licensed and maintained by Jens Petersen
This version can be pinned in stack with:simple-prompt-0.2.2@sha256:126e265c318125666752824209aca745ceab5aa88f9de27211f0653d324d2139,2070

Module documentation for 0.2.2

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.

Changes

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

0.2.0 (2023-05-28)

  • new API using haskeline and MonadIO
  • prompt ignores buffered stdin lines if it returns in milliseconds
  • promptEnter replaces prompt_
  • new functions: promptEnter, promptInitial, promptNonEmpty, promptPassword
  • yesNo and yesNoDefault replace yesno
  • internal haskeline functions in SimplePrompt.Internal: including getPrompt*, runPrompt, untilInput, mapInput, nonEmptyInput, timedInput

0.1.0 (2023-04-02)

  • initial release with prompt, prompt_, yesno functions