input

Prompt for input with readline-like key bindings

git clone https://git.8pit.net/input.git

 1# input
 2
 3Prompt for input with readline-like key bindings.
 4
 5## Motivation
 6
 7I needed a program to interactively read data from standard input in a
 8shell script, preferably with readline-like key bindings. Back then I
 9didn't know about [rlwrap][rlwrap repo] and implemented this from
10scratch by myself. Contrary to rlwrap, this implementation focuses on
11shell scripting and not on providing a "readline wrapper" for existing
12applications. As an additional difference, input initially used a fork
13of the [linenoise][linenoise repo] editing library.  Since linenoise
14wasn't properly maintained, later version switched to BSD editline and
15GNU readline. The last version, released with linenoise support, is
16`0.7.2`.
17
18## Status
19
20I use this as part of my [IRC client][insomnia repo] on a daily basis.
21For this use case, it works entirely fine as is. However, further
22improvements could be made to generalize the completion setup.
23
24## Features
25
26* Support for readline-like key bindings.
27* Support for tab completions using arbitrary commands.
28* Support for a persistent editing history.
29
30## Installation
31
32The following software is required:
33
34* A C99 compiler
35* [GNU make][GNU make] (sorry!)
36* [GNU readline][GNU readline] (or BSD editline)
37
38The program can be installed using:
39
40	$ make install
41
42On BSD using editline instead of readline is possible by installing using:
43
44	$ gmake LDLIBS="-ledit -lncurses" install
45
46## Testing
47
48A test suite using [tmux][tmux homepage] is also available. The test
49suite relies on heuristics to determine whether the process under test
50is ready to receive input and might thus be a bit racy. It can be
51invoked using:
52
53	$ make check
54
55## License
56
57This program is free software: you can redistribute it and/or modify it
58under the terms of the GNU General Public License as published by the
59Free Software Foundation, either version 3 of the License, or (at your
60option) any later version.
61
62This program is distributed in the hope that it will be useful, but
63WITHOUT ANY WARRANTY; without even the implied warranty of
64MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
65Public License for more details.
66
67You should have received a copy of the GNU General Public License along
68with this program. If not, see <http://www.gnu.org/licenses/>.
69
70[rlwrap repo]: https://github.com/hanslub42/rlwrap
71[linenoise repo]: https://github.com/antirez/linenoise
72[GNU readline]: https://tiswww.case.edu/php/chet/readline/rltop.html
73[GNU make]: https://www.gnu.org/software/make/
74[tmux homepage]: https://tmux.github.io
75[insomnia repo]: https://github.com/nmeum/insomnia