[ bsd3, library, program, unclassified ] [ Propose Tags ]

Please see the README on Github at https://github.com/ChrisPenner/eve-cli#readme

[Skip to Readme]
Versions [RSS] [faq]
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), bytestring (==0.10.*), eve (==0.1.*), eve-cli, lens (==4.16.*), mtl (==2.2.*), text (==1.2.*), vty (>=5.20 && <6) [details]
License BSD-3-Clause
Copyright Chris Penner
Author Chris Penner
Maintainer christopher.penner@gmail.com
Home page https://github.com/ChrisPenner/eve-cli#readme
Bug tracker https://github.com/ChrisPenner/eve-cli/issues
Source repo head: git clone https://github.com/ChrisPenner/eve-cli
Uploaded by ChrisPenner at 2018-04-05T02:47:43Z
Distributions NixOS:
Executables eve-cli-exe
Downloads 551 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-04-14 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees


Readme for eve-cli-

[back to package description]


Eve.CLI provides eve compatible helpers for building CLI apps. It allows you to:

  • Respond to Keyboard, Mouse, and Resize Events
  • Render text/images to your terminal

Here's what it looks like:

module Main where

import Eve (eve_, App, exit)
import Eve.CLI (initCLI, onKeypress_, renderImage, Keypress(..))
import qualified Data.Text.Lazy as T
import qualified Graphics.Vty as V
import Control.Monad (void)

main :: IO ()
main = eve_ $ do
  onKeypress_ showKeypress
      -- | Display the last key combination that you pressed on screen
      showKeypress :: Keypress -> App ()
      showKeypress (Keypress V.KEsc _) = exit
      showKeypress keypress = void . renderImage $ V.text V.defAttr . T.pack . show $ keypress


Eve.CLI is a small wrapper on top of vty; so you'll also need to import Graphics.Vty in order to interact with most events. The following event listeners are provided:

  • onEvent
  • onKeypress
  • onMouseDown
  • onMouseUp
  • onResize
  • onPaste

See the hackage docs for more in depth API documentation.


Currently Eve.CLI supports only rendering a Vty.Image; this means you can use any of Vty's image building combinators, then simply call renderImage with the image you've built.