Module | Readline |
In: |
lib/readline.rb
|
encoding: US-ASCII
readline.rb — GNU Readline module Copyright (C) 1997-2001 Shugo Maeda
Ruby translation by Park Heesob phasis@gmail.com
HISTORY | = | History |
FILENAME_COMPLETION_PROC | = | Fcomp |
USERNAME_COMPLETION_PROC | = | Ucomp |
VERSION | = | RbReadline.rl_library_version |
Returns the list of quote characters that can cause a word break. The default is "’\"" (single and double quote characters).
Returns the character string that signal a break between words for the completion proc. The default is " \t\n\"\’`@$><=|&{(".
Returns the list of characters that can be used to quote a substring of the line, i.e. a group of characters inside quotes.
Sets the list of characters that can be used to quote a substring of the line, i.e. a group of characters within quotes.
Returns the character that is automatically appended after the Readline.completion_proc method is called.
Sets the character that is automatically appended after the Readline.completion_proc method is called.
If char is nil or empty, then a null character is used.
Returns whether or not the completion proc is case sensitive. The default is false, i.e. completion procs are case sensitive.
Sets whether or not the completion proc should ignore case sensitivity. The default is false, i.e. completion procs are case sensitive.
Sets the auto-completion procedure (i.e. tab auto-complete).
The proc argument is typically a Proc object. It must respond to .call, take a single String argument and return an Array of candidates for completion.
Example:
list = ['search', 'next', 'clear'] Readline.completion_proc = proc{ |s| list.grep( /^#{Regexp.escape(s)}/) }
Sets the character string of one or more characters that indicate quotes for the filename completion of user input.
Sets the output stream (an IO object) for readline interaction. The default is $stdout.
Returns nil if no matches are found or an array of strings:
[0] is the replacement for text [1..n] the possible matches [n+1] nil
The possible matches should not include [0].
If this method sets RbReadline.rl_attempted_completion_over to true, then the default completion function will not be called when this function returns nil.
Begins an interactive terminal process using prompt as the command prompt that users see when they type commands. The method returns the line entered whenever a carriage return is encountered.
If an add_history argument is provided, commands entered by users are stored in a history buffer that can be recalled for later use.
Note that this method depends on $stdin and $stdout both being open. Because this is meant as an interactive console interface, they should generally not be redirected.
If you would like to add non-visible characters to the the prompt (for example to add colors) you must prepend the character \001 (^A) before each sequence of non-visible characters and add the character \002 (^B) after, otherwise line wrapping may not work properly.
Example:
loop{ Readline.readline('> ') }