ocean.io.console.readline.Readline

A D wrapper around the GNU readline/readline file

readline is a powerful library for reading the user input from the console.

For example if an application frequently asks for user-input during its operation then using readline provides the following benefits: - User can browse previous submitted lines using up/down arrows. - Terminal shortcuts (e.g ctrl+r, ctrl+w, ctrl+y) are enabled by default. - Providing text auto-completion, by default it is enabled to complete files and directories for the path that the application was run from. - Make the application use the customized configuration that the user defined for readline on his machine.

There are much more functionalities that the readline library provides. Please refer to the documentation for the more information: - http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html

Notes: Requires linking with -lreadline

Members

Aliases

CommandFunc
alias CommandFunc = C.rl_command_func_t

Function signature for functions used with the rl_bind_key functions and various other functions.

abort
alias abort = C.rl_abort

Completion functions to be used with key bindings

insert
alias insert = C.rl_insert
Undocumented in source.

Functions

bindKey
void bindKey(char key, CommandFunc* func)

Bind a keyboard key to a function.

readline
mstring readline(mstring prompt, mstring buffer)

Reads a line from the terminal and return it, using prompt as a prompt. If prompt is NULL or the empty string, no prompt is issued. The line returned has the final newline removed, so only the text of the line remains.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).

Bear in mind this module provides bindings to an external library that has its own license, which might be more restrictive. Please check the external library license to see which conditions apply for linking.