[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: [ANN] lua-rote, Lua binding to ROTE, Terminal Emulation library
- From: Nagaev Boris <bnagaev@...>
- Date: Wed, 25 Mar 2015 15:22:40 +0000
I'd like to introduce lua-rote, Lua binding to ROTE.
ROTE is a simple C library for VT102 terminal emulation. It is
extremely useful to programmatically interact with curses applications
(e.g., for unit testing).
License: Lesser GPL 2.1
* install curses, luaposix and ROTE
* luarocks install lua-rote
lua-rote has almost all functions of ROTE, namely:
* create a virtual terminal
* read contents of the virtual terminal
* fork a child process
* feed data to the child process
* draw contents of the virtual terminal on curses window
Most of ROTE functions are represented as class RoteTerm on Lua side.
All functions are covered with unit tests.
Example demo/boxshell.c from ROTE was implemented in pure Lua using
luaposix and lua-rote. Both programs include the following steps:
* start curses,
* fill the screen with blue,
* create curses window in the middle of the screen,
* start ROTE terminal, fork bash inside,
* do in a loop until child process dies:
- redraw curses window accorsing to ROTE terminal,
- getch(), results of which are passed to ROTE terminal.
I use lua-rote for unit tests of my other project, alnbox . Alnbox is
alignment viewer based on the curses library. It is used to view an
alignment of biological sequences from FASTA file in terminal.
Scrolling through alignment is provided by arrow buttons, quit with
button 'q'. Unit tests include the following steps: starting alnbox
under lua-rote, "pressing" arrow keys, validating contents of the
terminal . Unit testing framework Busted is used . Test coverage
of both lua-rote and alnbox is 100%.