Raku module Term::ReadKey, reads single unbuffered keys from terminal.
Find a file
2026-08-30 15:19:42 +02:00
lib/Term Update META6.json. 2026-08-30 15:17:43 +02:00
t Initial import. 2018-08-15 13:43:02 +02:00
.gitignore Initial import. 2018-08-15 13:43:02 +02:00
.travis.yml Initial import. 2018-08-15 13:43:02 +02:00
Changes Initial import. 2018-08-15 13:43:02 +02:00
dist.ini Initial import. 2018-08-15 13:43:02 +02:00
LICENSE Initial import. 2018-08-15 13:43:02 +02:00
META6.json Fix auth in META6.json. 2026-08-30 15:19:42 +02:00
README.md README syntax/format. 2026-08-30 13:54:28 +02:00

NAME

Term::ReadKey

DESCRIPTION

Read single (unbuffered) keys from terminal.

SYNOPSIS

use Term::ReadKey;

react {
  whenever key-pressed(:!echo) {
    given .fc {
      when 'q' { done }
      default { .uniname.say }
    }
  }
}

FUNCTIONS

read-key(Bool :$echo = True --> Str)

Reads one unbuffered (unicode) character from STDIN and returns it as Str or Nil if nothing could be read. By default the typed character will be echoed to the terminal unless :!echo is passed as argument.

key-pressed(Bool :$echo = True --> Supply)

Returns a supply that emits characters as soon as they're typed (see example in SYNOPSIS). The named argument :$echo can be used to enable/disable echoing of the character (on by default).

AUTHOR

Jonas Kramer jkramer@mark17.net

COPYRIGHT AND LICENSE

Copyright 2018 Jonas Kramer.

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.