Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e6d7bfc

Browse filesBrowse files
julianduqueMyles Borins
authored andcommitted
doc: add added: information for readline
Got the information from git history, I added the version when Interface was exported as class (v0.1.104), it was an internal class on previous versions. Refs: #6578 PR-URL: #6996 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent eec0c63 commit e6d7bfc
Copy full SHA for e6d7bfc

File tree

Expand file treeCollapse file tree

1 file changed

+63
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+63
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/readline.md‎

Copy file name to clipboardExpand all lines: doc/api/readline.md
+63Lines changed: 63 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,35 @@ rl.question('What do you think of Node.js? ', (answer) => {
2626
```
2727

2828
## Class: Interface
29+
<!-- YAML
30+
added: v0.1.104
31+
-->
2932

3033
The class that represents a readline interface with an input and output
3134
stream.
3235

3336
### rl.close()
37+
<!-- YAML
38+
added: v0.1.98
39+
-->
3440

3541
Closes the `Interface` instance, relinquishing control on the `input` and
3642
`output` streams. The `'close'` event will also be emitted.
3743

3844
### rl.pause()
45+
<!-- YAML
46+
added: v0.3.4
47+
-->
3948

4049
Pauses the readline `input` stream, allowing it to be resumed later if needed.
4150

4251
Note that this doesn't immediately pause the stream of events. Several events may
4352
be emitted after calling `pause`, including `line`.
4453

4554
### rl.prompt([preserveCursor])
55+
<!-- YAML
56+
added: v0.1.98
57+
-->
4658

4759
Readies readline for input from the user, putting the current `setPrompt`
4860
options on a new line, giving the user a new spot to write. Set `preserveCursor`
@@ -55,6 +67,9 @@ If `output` is set to `null` or `undefined` when calling `createInterface`, the
5567
prompt is not written.
5668

5769
### rl.question(query, callback)
70+
<!-- YAML
71+
added: v0.3.3
72+
-->
5873

5974
Prepends the prompt with `query` and invokes `callback` with the user's
6075
response. Displays the query to the user, and then invokes `callback`
@@ -75,15 +90,24 @@ rl.question('What is your favorite food?', (answer) => {
7590
```
7691

7792
### rl.resume()
93+
<!-- YAML
94+
added: v0.3.4
95+
-->
7896

7997
Resumes the readline `input` stream.
8098

8199
### rl.setPrompt(prompt)
100+
<!-- YAML
101+
added: v0.1.98
102+
-->
82103

83104
Sets the prompt, for example when you run `node` on the command line, you see
84105
`> `, which is Node.js's prompt.
85106

86107
### rl.write(data[, key])
108+
<!-- YAML
109+
added: v0.1.98
110+
-->
87111

88112
Writes `data` to `output` stream, unless `output` is set to `null` or
89113
`undefined` when calling `createInterface`. `key` is an object literal to
@@ -102,6 +126,9 @@ rl.write(null, {ctrl: true, name: 'u'});
102126
## Events
103127

104128
### Event: 'close'
129+
<!-- YAML
130+
added: v0.1.98
131+
-->
105132

106133
`function () {}`
107134

@@ -115,6 +142,9 @@ This event is also called if there is no `SIGINT` event listener present when
115142
the `input` stream receives a `^C`, respectively known as `SIGINT`.
116143

117144
### Event: 'line'
145+
<!-- YAML
146+
added: v0.1.98
147+
-->
118148

119149
`function (line) {}`
120150

@@ -131,6 +161,9 @@ rl.on('line', (cmd) => {
131161
```
132162

133163
### Event: 'pause'
164+
<!-- YAML
165+
added: v0.7.5
166+
-->
134167

135168
`function () {}`
136169

@@ -148,6 +181,9 @@ rl.on('pause', () => {
148181
```
149182

150183
### Event: 'resume'
184+
<!-- YAML
185+
added: v0.7.5
186+
-->
151187

152188
`function () {}`
153189

@@ -162,6 +198,9 @@ rl.on('resume', () => {
162198
```
163199

164200
### Event: 'SIGCONT'
201+
<!-- YAML
202+
added: v0.7.5
203+
-->
165204

166205
`function () {}`
167206

@@ -182,6 +221,9 @@ rl.on('SIGCONT', () => {
182221
```
183222

184223
### Event: 'SIGINT'
224+
<!-- YAML
225+
added: v0.3.0
226+
-->
185227

186228
`function () {}`
187229

@@ -200,6 +242,9 @@ rl.on('SIGINT', () => {
200242
```
201243

202244
### Event: 'SIGTSTP'
245+
<!-- YAML
246+
added: v0.7.5
247+
-->
203248

204249
`function () {}`
205250

@@ -272,6 +317,9 @@ rl.on('line', (line) => {
272317
```
273318

274319
## readline.clearLine(stream, dir)
320+
<!-- YAML
321+
added: v0.7.7
322+
-->
275323

276324
Clears current line of given TTY stream in a specified direction.
277325
`dir` should have one of following values:
@@ -281,10 +329,16 @@ Clears current line of given TTY stream in a specified direction.
281329
* `0` - the entire line
282330

283331
## readline.clearScreenDown(stream)
332+
<!-- YAML
333+
added: v0.7.7
334+
-->
284335

285336
Clears the screen from the current position of the cursor down.
286337

287338
## readline.createInterface(options)
339+
<!-- YAML
340+
added: v0.1.98
341+
-->
288342

289343
Creates a readline `Interface` instance. Accepts an `options` Object that takes
290344
the following values:
@@ -351,17 +405,26 @@ a `'resize'` event on the `output` if/when the columns ever change
351405
([`process.stdout`][] does this automatically when it is a TTY).
352406

353407
## readline.cursorTo(stream, x, y)
408+
<!-- YAML
409+
added: v0.7.7
410+
-->
354411

355412
Move cursor to the specified position in a given TTY stream.
356413

357414
## readline.emitKeypressEvents(stream[, interface])
415+
<!-- YAML
416+
added: v0.7.7
417+
-->
358418

359419
Causes `stream` to begin emitting `'keypress'` events corresponding to its
360420
input.
361421
Optionally, `interface` specifies a `readline.Interface` instance for which
362422
autocompletion is disabled when copy-pasted input is detected.
363423

364424
## readline.moveCursor(stream, dx, dy)
425+
<!-- YAML
426+
added: v0.7.7
427+
-->
365428

366429
Move cursor relative to it's current position in a given TTY stream.
367430

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.