|
|
@ -1,4 +1,4 @@ |
|
|
|
## Readline |
|
|
|
# Readline |
|
|
|
|
|
|
|
To use this module, do `require('readline')`. Readline allows reading of a |
|
|
|
stream (such as STDIN) on a line-by-line basis. |
|
|
@ -20,7 +20,7 @@ to allow your program to gracefully terminate: |
|
|
|
process.stdin.destroy(); |
|
|
|
}); |
|
|
|
|
|
|
|
### rl.createInterface(input, output, completer) |
|
|
|
## rl.createInterface(input, output, completer) |
|
|
|
|
|
|
|
Takes two streams and creates a readline interface. The `completer` function |
|
|
|
is used for autocompletion. When given a substring, it returns `[[substr1, |
|
|
@ -38,6 +38,11 @@ Also `completer` can be run in async mode if it accepts two arguments: |
|
|
|
var readline = require('readline'), |
|
|
|
rl = readline.createInterface(process.stdin, process.stdout); |
|
|
|
|
|
|
|
## Class: Interface |
|
|
|
|
|
|
|
The class that represents a readline interface with a stdin and stdout |
|
|
|
stream. |
|
|
|
|
|
|
|
### rl.setPrompt(prompt, length) |
|
|
|
|
|
|
|
Sets the prompt, for example when you run `node` on the command line, you see |
|
|
@ -48,8 +53,6 @@ Sets the prompt, for example when you run `node` on the command line, you see |
|
|
|
Readies readline for input from the user, putting the current `setPrompt` |
|
|
|
options on a new line, giving the user a new spot to write. |
|
|
|
|
|
|
|
<!-- ### rl.getColumns() Not available? --> |
|
|
|
|
|
|
|
### rl.question(query, callback) |
|
|
|
|
|
|
|
Prepends the prompt with `query` and invokes `callback` with the user's |
|
|
|