howl.ui.Readline

howl.ui.Readline

Readline instances are the primary way of obtaining user input in Howl. Each Window instance has an associated .readline field which you’ll use to access the readline instance. Note that while interacting with a Readline instance directly is fine, you would typically write a command instead, which manages the Readline handling for you.

See also:

Properties

width_in_columns

Holds the width of the readline, in character columns. This only available when the Readline is showing, and is nil otherwise.

prompt

The prompt as shown in the Readline. Read/write.

text

The text currently in the Readline. The text is defined as being everything in the input line that is not part of the prompt. Read/write.

title

The title of the Readline window. Read/write.

Methods

complete (force = false)

If the Readline is open, this requests that a completion should be attempted for the text currently in the Readline.

This would typically be used from inputs only - calling this when the Readline is not showing raises an error.

hide ()

Hides the Readline if it’s currently showing. Done automatically by read, and thus not typically used.

notify (text, style)

Causes text to be shown above the input line in the Readline. As the status bar is hidden while the Readline is showing, this can be used to display notifications to the user when in the readline. style optionally specifies the style to use when displaying the text, and is one of the available styles from style.

read (prompt, input = {}, opts = {})

Prompts the user for input. prompt will be displayed as the Readline prompt. input specifies an optional “input” to use for controlling the user input. opts is an optional table, which if passed may contain the following keys:

The method returns the value as input from the user, or nil if the user cancels. Note that the type of the value returned is dependent on the input.

To understand how to utilize for best effect, read through the documentation for inputs.

show ()

Shows the Readline if it’s currently hidden. Done automatically by read, and thus not typically used.

to_gobject ()

Returns the underlying Gtk widget.