Redis author releases Linenoise for line editing everywhere
Salvator Sanfilippo, also known as Antirez, has released Linenoise, a compact and BSD licensed alternative to the GPL licensed readline. Sanfilippo, who recently joined VMware to work on development of his open source distributed key/value store Redis, has created the library after finding that existing solutions took between 20K and 30K of memory, an amount he found unacceptable for smaller utilities. "Apparently code dealing with terminals is some sort of Black Magic" says Sanfilippo, "Is it reasonable to link small utilities to huge libraries just to get a minimal support for line editing? The result is a pollution of binaries without line editing support",
Sanfilippo became more aware of the issue while developing redis-cli. At less than 400 lines of code, the Linenoise library uses basic VT100 codes and requires no configuration. The "trivial to embed" library will allow smaller programs to support line editing out of the box. The library is young, says Sanfilippo, but initial bugs or compilation issues should be resolved in a "matter of weeks" after which "there will be no excuses for not shipping command line tools without built-in line editing support". The Linenoise library can be used in commercial or free software because of its BSD licence and is hosted on on Github.