input

Prompt for input with readline-like key bindings

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

commits

2023-07-22 Restore compatibility with BSD editline and older GNU readline versions Sören Tempel
2023-07-22 Don't sort completion matches alphabetically Sören Tempel
2021-05-01 tests: update expected hist-size output Sören Tempel
2021-04-04 README.md: Add status section Sören Tempel
2021-04-04 Improve code for removing trailing getline(3) newlines Sören Tempel

Clone the repository to access all 106 commits.

input

Prompt for input with readline-like key bindings.

Motivation

I needed a program to interactively read data from standard input in a shell script, preferably with readline-like key bindings. Back then I didn’t know about rlwrap and implemented this from scratch by myself. Contrary to rlwrap, this implementation focuses on shell scripting and not on providing a “readline wrapper” for existing applications. As an additional difference, input initially used a fork of the linenoise editing library. Since linenoise wasn’t properly maintained, later version switched to BSD editline and GNU readline. The last version, released with linenoise support, is 0.7.2.

Status

I use this as part of my IRC client on a daily basis. For this use case, it works entirely fine as is. However, further improvements could be made to generalize the completion setup.

Features

Installation

The following software is required:

The program can be installed using:

$ make install

On BSD using editline instead of readline is possible by installing using:

$ gmake LDLIBS="-ledit -lncurses" install

Testing

A test suite using tmux is also available. The test suite relies on heuristics to determine whether the process under test is ready to receive input and might thus be a bit racy. It can be invoked using:

$ make check

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.