Module

Node.ReadLine

Package
purescript-node-readline
Repository
purescript-node/purescript-node-readline

This module provides a binding to the Node readline API.

#Interface Source

data Interface :: Type

A handle to a console interface.

A handle can be created with the createInterface function.

#InterfaceOptions Source

data InterfaceOptions :: Type

Options passed to readline's createInterface

#Completer Source

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 Source

type LineHandler a = String -> Effect a

A function which handles each line of input.

#createInterface Source

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

Builds an interface with the specified options.

#createConsoleInterface Source

createConsoleInterface :: Completer -> Effect Interface

Create an interface with the specified completion function.

#noCompletion Source

noCompletion :: Completer

A completion function which offers no completions.

#prompt Source

prompt :: Interface -> Effect Unit

Prompt the user for input on the specified Interface.

#setPrompt Source

setPrompt :: String -> Int -> Interface -> Effect Unit

Set the prompt.

#setLineHandler Source

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

Set the current line handler function.

#close Source

close :: Interface -> Effect Unit

Close the specified Interface.

#question Source

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
Node.ReadLine