doc: add args for rl.write and rl.prompt

pull/24503/head
Kyle Robinson Young 2012-04-20 20:06:00 -07:00 committed by Ben Noordhuis
parent da56c72f59
commit 525253d50e
1 changed files with 12 additions and 4 deletions

View File

@ -91,10 +91,11 @@ stream.
Sets the prompt, for example when you run `node` on the command line, you see
`> `, which is node's prompt.
### rl.prompt()
### rl.prompt([preserveCursor])
Readies readline for input from the user, putting the current `setPrompt`
options on a new line, giving the user a new spot to write.
options on a new line, giving the user a new spot to write. Set `preserveCursor`
to `true` to prevent the cursor placement being reset to `0`.
This will also resume the `input` stream used with `createInterface` if it has
been paused.
@ -127,12 +128,19 @@ Resumes the readline `input` stream.
Closes the `Interface` instance, relinquishing control on the `input` and
`output` streams. The "close" event will also be emitted.
### rl.write()
### rl.write(data, [key])
Writes to `output` stream.
Writes `data` to `output` stream. `key` is an object literal to represent a key
sequence; available if the terminal is a TTY.
This will also resume the `input` stream if it has been paused.
Example:
rl.write('Delete me!');
// Simulate ctrl+u to delete the line written previously
rl.write(null, {ctrl: true, name: 'u'});
## Events
### Event: 'line'