From 525253d50e0a1dbfe1a06c89d3a94e16bab2fcb8 Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Fri, 20 Apr 2012 20:06:00 -0700 Subject: [PATCH] doc: add args for rl.write and rl.prompt --- doc/api/readline.markdown | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/api/readline.markdown b/doc/api/readline.markdown index 92ab7b54bb5..c75685935e4 100644 --- a/doc/api/readline.markdown +++ b/doc/api/readline.markdown @@ -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'