| readline-1.0.1.0: An interface to the GNU readline library | Contents | Index |
|
System.Console.Readline | Portability | non-portable (requires libreadline) | Stability | provisional | Maintainer | libraries@haskell.org |
|
|
|
Description |
A Haskell binding to the GNU readline library. The GNU Readline
library provides a set of functions for use by applications that
allow users to edit command lines as they are typed in. By
default, the line editing commands are similar to those of
emacs. A vi-style line editing interface is also available.
An example of a typical use of readline with history functionality
is illustrated in the following read, eval, print loop:
readEvalPrintLoop :: IO ()
readEvalPrintLoop = do
maybeLine <- readline "% "
case maybeLine of
Nothing -> return () -- EOF / control-d
Just "exit" -> return ()
Just line -> do addHistory line
putStrLn $ "The user input: " ++ (show line)
readEvalPrintLoop
|
|
Synopsis |
|
|
|
Documentation |
|
readline |
:: String | prompt
| -> IO (Maybe String) | returns the line the user input, or Nothing if EOF is encountered.
| readline is similar to getLine, but with rich edit
functionality and history capability. readline will read a line
from the terminal and return it, using prompt as a prompt. If
prompt is the empty string, no prompt is issued. The line returned
has the final newline removed, so only the text of the line
remains. A blank line returns the empty string. If EOF is
encountered while reading a line, and the line is empty, Nothing is
returned. If an EOF is read with a non-empty line, it is treated
as a newline.
|
|
|
addHistory :: String -> IO () |
Add this command to the history. This allows users to search backward
through history with C-r and step through with up and down arrows, among
other things.
|
|
getLineBuffer :: IO String |
|
setLineBuffer :: String -> IO () |
|
getPoint :: IO Int |
|
setPoint :: Int -> IO () |
|
getEnd :: IO Int |
|
setEnd :: Int -> IO () |
|
getMark :: IO Int |
|
setMark :: Int -> IO () |
|
setDone :: Bool -> IO () |
|
setPendingInput :: Char -> IO () |
|
setEraseEmptyLine :: Bool -> IO () |
|
getPrompt :: IO String |
|
setAlreadyPrompted :: Bool -> IO () |
|
getLibraryVersion :: IO String |
|
getTerminalName :: IO String |
|
setReadlineName :: String -> IO () |
|
getInStream :: IO Handle |
|
getOutStream :: IO Handle |
|
setStartupHook :: Maybe (IO ()) -> IO () |
|
setPreInputHook :: Maybe (IO ()) -> IO () |
|
setEventHook :: Maybe (IO ()) -> IO () |
|
setRedisplayFunction :: Maybe (IO ()) -> IO () |
|
data Keymap |
|
|
newBareKeymap :: IO Keymap |
|
copyKeymap :: Keymap -> IO Keymap |
|
newKeymap :: IO Keymap |
|
freeKeymap :: Keymap -> IO () |
|
getKeymap :: IO Keymap |
|
setKeymap :: Keymap -> IO () |
|
getKeymapByName :: String -> IO Keymap |
|
getKeymapName :: Keymap -> IO (Maybe String) |
|
getExecutingKeymap :: IO Keymap |
|
getBindingKeymap :: IO Keymap |
|
type Callback = Int -> Char -> IO Int |
|
addDefun :: String -> Callback -> Maybe Char -> IO () |
|
bindKey :: Char -> Callback -> IO () |
|
bindKeyInMap :: Char -> Callback -> Keymap -> IO () |
|
unbindKey :: Char -> IO () |
|
unbindKeyInMap :: Char -> Keymap -> IO () |
|
unbindCommandInMap :: String -> Keymap -> IO () |
|
data Entry |
|
|
genericBind :: String -> Entry -> Keymap -> IO () |
|
parseAndBind :: String -> IO () |
|
readInitFile :: String -> IO () |
|
namedFunction :: String -> IO (Maybe Callback) |
|
functionOfKeyseq :: String -> Maybe Keymap -> IO Entry |
|
functionDumper :: Bool -> IO () |
|
listFunmapNames :: IO () |
|
funmapNames :: IO [String] |
|
beginUndoGroup :: IO () |
|
endUndoGroup :: IO () |
|
data UndoCode |
Constructors | UndoDelete | | UndoInsert | | UndoBegin | | UndoEnd | |
|
|
|
addUndo :: UndoCode -> Int -> Int -> String -> IO () |
|
freeUndoList :: IO () |
|
doUndo :: IO Bool |
|
modifying :: Int -> Int -> IO () |
|
redisplay :: IO () |
|
forcedUpdateDisplay :: IO () |
|
onNewLine :: IO () |
|
onNewLineWithPrompt :: IO () |
|
resetLineState :: IO () |
|
message :: String -> IO () |
|
clearMessage :: IO () |
|
savePrompt :: IO () |
|
restorePrompt :: IO () |
|
insertText :: String -> IO () |
|
deleteText :: Int -> Int -> IO () |
|
copyText :: Int -> Int -> IO String |
|
killText :: Int -> Int -> IO () |
|
readKey :: IO Char |
|
stuffChar :: Char -> IO Bool |
|
initialize :: IO () |
|
resetTerminal :: Maybe String -> IO () |
|
ding :: IO Bool |
|
displayMatchList :: [String] -> IO () |
|
callbackHandlerInstall :: String -> (String -> IO ()) -> IO (IO ()) |
|
callbackReadChar :: IO () |
|
setCatchSignals :: Bool -> IO () |
|
getCatchSignals :: IO Bool |
|
setCatchSigwinch :: Bool -> IO () |
|
getCatchSigwinch :: IO Bool |
|
cleanupAfterSignal :: IO () |
|
freeLineState :: IO () |
|
resetAfterSignal :: IO () |
|
resizeTerminal :: IO () |
|
setSignals :: IO () |
|
clearSignals :: IO () |
|
completeInternal :: Char -> IO () |
|
complete :: Int -> Char -> IO Int |
|
possibleCompletions :: Int -> Char -> IO Int |
|
insertCompletions :: Int -> Char -> IO Int |
|
completionMatches :: String -> (String -> IO [String]) -> IO (Maybe (String, [String])) |
|
filenameCompletionFunction :: String -> IO [String] |
|
usernameCompletionFunction :: String -> IO [String] |
|
setCompletionEntryFunction :: Maybe (String -> IO [String]) -> IO () |
|
setAttemptedCompletionFunction :: Maybe (String -> Int -> Int -> IO (Maybe (String, [String]))) -> IO () |
|
setFilenameQuotingFunction :: Maybe (String -> Bool -> Ptr CChar -> IO String) -> IO () |
|
quoteFilename :: String -> Bool -> Ptr CChar -> IO String |
|
setFilenameDequotingFunction :: Maybe (String -> Maybe Char -> IO String) -> IO () |
|
setCharIsQuotedP :: Maybe (String -> Int -> IO Bool) -> IO () |
|
getCompletionQueryItems :: IO Int |
|
setCompletionQueryItems :: Int -> IO () |
|
getBasicWordBreakCharacters :: IO String |
|
setBasicWordBreakCharacters :: String -> IO () |
|
getBasicQuoteCharacters :: IO String |
|
setBasicQuoteCharacters :: String -> IO () |
|
getCompleterWordBreakCharacters :: IO String |
|
setCompleterWordBreakCharacters :: String -> IO () |
|
getCompleterQuoteCharacters :: IO String |
|
setCompleterQuoteCharacters :: String -> IO () |
|
getFilenameQuoteCharacters :: IO String |
|
setFilenameQuoteCharacters :: String -> IO () |
|
getSpecialPrefixes :: IO String |
|
setSpecialPrefixes :: String -> IO () |
|
getCompletionAppendCharacter :: IO (Maybe Char) |
|
setCompletionAppendCharacter :: Maybe Char -> IO () |
|
setIgnoreCompletionDuplicates :: Bool -> IO () |
|
getIgnoreCompletionDuplicates :: IO Bool |
|
setFilenameCompletionDesired :: Bool -> IO () |
|
getFilenameCompletionDesired :: IO Bool |
|
setFilenameQuotingDesired :: Bool -> IO () |
|
getFilenameQuotingDesired :: IO Bool |
|
setInhibitCompletion :: Bool -> IO () |
|
getInhibitCompletion :: IO Bool |
|
setAttemptedCompletionOver :: Bool -> IO () |
|
getAttemptedCompletionOver :: IO Bool |
|
setIgnoreSomeCompletionsFunction :: Maybe ([String] -> IO [String]) -> IO () |
|
setDirectoryCompletionHook :: Maybe (String -> IO String) -> IO () |
|
setCompletionDisplayMatchesHook :: Maybe ([String] -> IO ()) -> IO () |
|
Produced by Haddock version 0.8 |