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.

#READLINE Source

data READLINE :: Effect

The effect of interacting with a stream via an Interface

#InterfaceOptions Source

data InterfaceOptions

Options passed to readline's createInterface

#output Source

output :: forall eff w. Option InterfaceOptions (Writable w eff)

#completer Source

#Completer Source

type Completer eff = String -> Eff eff { 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.

#createInterface Source

createInterface :: forall eff r. Readable r (readline :: READLINE | eff) -> Options InterfaceOptions -> Eff (readline :: READLINE | eff) Interface

Builds an interface with the specified options.

#createConsoleInterface Source

createConsoleInterface :: forall eff. Completer (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | eff) -> Eff (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | eff) Interface

Create an interface with the specified completion function.

#noCompletion Source

noCompletion :: forall eff. Completer eff

A completion function which offers no completions.

#prompt Source

prompt :: forall eff. Interface -> Eff (readline :: READLINE | eff) Unit

Prompt the user for input on the specified Interface.

#setPrompt Source

setPrompt :: forall eff. String -> Int -> Interface -> Eff (readline :: READLINE | eff) Unit

Set the prompt.

#close Source

close :: forall eff. Interface -> Eff (readline :: READLINE | eff) Unit

Close the specified Interface.

#LineHandler Source

type LineHandler eff a = String -> Eff eff a

A function which handles each line of input.

#setLineHandler Source

setLineHandler :: forall a eff. Interface -> LineHandler (readline :: READLINE | eff) a -> Eff (readline :: READLINE | eff) Unit

Set the current line handler function.

Modules
Node.ReadLine