simple-prompt

Simple commandline text prompt functions

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

Version on this page:0.2.0.1
LTS Haskell 22.21:0.2.2
Stackage Nightly 2024-05-06:0.2.2
Latest on Hackage:0.2.2

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.0.1@sha256:004aabe8a1f7ba96bbf207e301615d3a29482293b973ea7ad0e857f1391a7aea,2033

Module documentation for 0.2.0.1

Used by 1 package in nightly-2023-06-21(full list with versions):

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 prompt for a character
  • 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, timedInput, nonEmptyInput.

Changes

Revision history for simple-prompt

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