Module

Node.ReadLine

This module provides a binding to the Node readline API.

#Interface

data Interface

A handle to a console interface.

A handle can be created with the createInterface function.

#InterfaceOptions

data InterfaceOptions

Options passed to readline's createInterface

#Completer

type Completer = String -> Effect { completions :: Array String, matched :: String }

A function which performs tab completion.

This function takes the partial command as input, and returns a collection of completions, as well as the matched portion of the input string.

#LineHandler

type LineHandler a = String -> Effect a

A function which handles each line of input.

#createInterface

createInterface :: forall r. Readable r -> Options InterfaceOptions -> Effect Interface

Builds an interface with the specified options.

#createConsoleInterface

createConsoleInterface :: Completer -> Effect Interface

Create an interface with the specified completion function.

#output

#noCompletion

noCompletion :: Completer

A completion function which offers no completions.

#prompt

prompt :: Interface -> Effect Unit

Prompt the user for input on the specified Interface.

#setPrompt

setPrompt :: String -> Interface -> Effect Unit

Set the prompt.

#setLineHandler

setLineHandler :: forall a. LineHandler a -> Interface -> Effect Unit

Set the current line handler function.

#close

close :: Interface -> Effect Unit

Close the specified Interface.

#question

question :: String -> (String -> Effect Unit) -> Interface -> Effect Unit

Writes a query to the output, waits for user input to be provided on input, then invokes the callback function

Modules