haskeline-0.6.3.1: A command-line interface for user input, written in Haskell.Source codeContentsIndex
System.Console.Haskeline.Completion
Contents
Word completion
Filename completion
Synopsis
type CompletionFunc m = (String, String) -> m (String, [Completion])
data Completion = Completion {
replacement :: String
display :: String
isFinished :: Bool
}
noCompletion :: Monad m => CompletionFunc m
simpleCompletion :: String -> Completion
completeWord :: Monad m => Maybe Char -> [Char] -> (String -> m [Completion]) -> CompletionFunc m
completeWordWithPrev :: Monad m => Maybe Char -> [Char] -> (String -> String -> m [Completion]) -> CompletionFunc m
completeQuotedWord :: Monad m => Maybe Char -> [Char] -> (String -> m [Completion]) -> CompletionFunc m -> CompletionFunc m
completeFilename :: MonadIO m => CompletionFunc m
listFiles :: MonadIO m => FilePath -> m [Completion]
filenameWordBreakChars :: String
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
replacement :: StringText to insert in line.
display :: StringText to display when listing alternatives.
isFinished :: BoolWhether this word should be followed by a space, end quote, etc.
show/hide Instances
noCompletion :: Monad m => CompletionFunc mSource
Disable completion altogether.
simpleCompletion :: String -> CompletionSource
Create a finished completion out of the given word.
Word completion
completeWordSource
:: Monad m
=> Maybe CharAn optional escape character
-> [Char]Characters which count as whitespace
-> String -> m [Completion]Function to produce a list of possible completions
-> CompletionFunc m

A custom CompletionFunc which completes the word immediately to the left of the cursor.

A word begins either at the start of the line or after an unescaped whitespace character.

completeWordWithPrevSource
:: Monad m
=> Maybe CharAn optional escape character
-> [Char]Characters which count as whitespace
-> String -> String -> m [Completion]Function to produce a list of possible completions. The first argument is the line contents to the left of the word, reversed. The second argument is the word to be completed.
-> CompletionFunc m

A custom CompletionFunc which completes the word immediately to the left of the cursor, and takes into account the line contents to the left of the word.

A word begins either at the start of the line or after an unescaped whitespace character.

completeQuotedWordSource
:: Monad m
=> Maybe CharAn optional escape character
-> [Char]Characters which set off quotes
-> String -> m [Completion]Function to produce a list of possible completions
-> CompletionFunc mAlternate completion to perform if the cursor is not at a quoted word
-> CompletionFunc m
Filename completion
completeFilename :: MonadIO m => CompletionFunc mSource
listFiles :: MonadIO m => FilePath -> m [Completion]Source
List all of the files or folders beginning with this path.
filenameWordBreakChars :: StringSource
Produced by Haddock version 2.6.1