haskeline-0.6.2.1: A command-line interface for user input, written in Haskell.

System.Console.Haskeline.Completion

Contents

Synopsis

Documentation

type CompletionFunc m = (String, String) -> m (String, [Completion])Source

Performs completions from the given line state.

The first String argument is the contents of the line to the left of the cursor, reversed. The second String argument is the contents of the line to the right of the cursor.

The output String is the unused portion of the left half of the line, reversed.

data Completion Source

Constructors

Completion 

Fields

replacement :: String

Text to insert in line.

display :: String

Text to display when listing alternatives.

isFinished :: Bool

Whether this word should be followed by a space, end quote, etc.

Instances

completeWordSource

Arguments

:: Monad m 
=> Maybe Char

An optional escape character

-> String

List of characters which count as whitespace

-> (String -> m [Completion])

Function to produce a list of possible completions

-> CompletionFunc m 

The following function creates a custom CompletionFunc for use in the 'Settings.'

completeQuotedWordSource

Arguments

:: Monad m 
=> Maybe Char

An optional escape character

-> String 
-> (String -> m [Completion])

Function to produce a list of possible completions

-> CompletionFunc m

Alternate completion to perform if the cursor is not at a quoted word

-> CompletionFunc m 

Building CompletionFuncs

noCompletion :: Monad m => CompletionFunc mSource

Disable completion altogether.

simpleCompletion :: String -> CompletionSource

Create a finished completion out of the given word.

Filename completion

listFiles :: MonadIO m => FilePath -> m [Completion]Source

List all of the files or folders beginning with this path.