Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
doc: add args for rl.write and rl.prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
shama authored and bnoordhuis committed Apr 21, 2012
1 parent da56c72 commit 525253d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/api/readline.markdown
Expand Up @@ -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.
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 525253d

Please sign in to comment.