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 e9f33e3

Browse filesBrowse files
DannyNemerMylesBorins
authored andcommitted
readline: rename deDupeHistory option
Renames `options.deDupeHistory` → `options.removeHistoryDuplicates` for `readline.createInterface(options)`. The option name `removeHistoryDuplicates` is preferable to the semantically identical name `deDupeHistory` because "dedupe" (short for "deduplication") is obscure and neologistic while `removeHistoryDuplicates` is clear, though verbose. Updates tests and documentation for this option accordingly. PR-URL: #11950 Ref: #2982 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 8bd6ab7 commit e9f33e3
Copy full SHA for e9f33e3

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+13
-13
lines changed
Open diff view settings
Collapse file

‎doc/api/readline.md‎

Copy file name to clipboardExpand all lines: doc/api/readline.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ added: v0.1.98
363363
`crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate
364364
end-of-line input. Default to `100` milliseconds.
365365
`crlfDelay` will be coerced to `[100, 2000]` range.
366-
* `deDupeHistory` {boolean} If `true`, when a new input line added to the
367-
history list duplicates an older one, this removes the older line from the
368-
list. Defaults to `false`.
366+
* `removeHistoryDuplicates` {boolean} If `true`, when a new input line added
367+
to the history list duplicates an older one, this removes the older line
368+
from the list. Defaults to `false`.
369369

370370
The `readline.createInterface()` method creates a new `readline.Interface`
371371
instance.
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Interface(input, output, completer, terminal) {
3939

4040
EventEmitter.call(this);
4141
var historySize;
42-
var deDupeHistory = false;
42+
var removeHistoryDuplicates = false;
4343
let crlfDelay;
4444
let prompt = '> ';
4545

@@ -49,7 +49,7 @@ function Interface(input, output, completer, terminal) {
4949
completer = input.completer;
5050
terminal = input.terminal;
5151
historySize = input.historySize;
52-
deDupeHistory = input.deDupeHistory;
52+
removeHistoryDuplicates = input.removeHistoryDuplicates;
5353
if (input.prompt !== undefined) {
5454
prompt = input.prompt;
5555
}
@@ -82,7 +82,7 @@ function Interface(input, output, completer, terminal) {
8282
this.output = output;
8383
this.input = input;
8484
this.historySize = historySize;
85-
this.deDupeHistory = !!deDupeHistory;
85+
this.removeHistoryDuplicates = !!removeHistoryDuplicates;
8686
this.crlfDelay = Math.max(kMincrlfDelay,
8787
Math.min(kMaxcrlfDelay, crlfDelay >>> 0));
8888

@@ -252,7 +252,7 @@ Interface.prototype._addHistory = function() {
252252
if (this.line.trim().length === 0) return this.line;
253253

254254
if (this.history.length === 0 || this.history[0] !== this.line) {
255-
if (this.deDupeHistory) {
255+
if (this.removeHistoryDuplicates) {
256256
// Remove older history line if identical to new one
257257
const dupIndex = this.history.indexOf(this.line);
258258
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
Collapse file

‎test/parallel/test-readline-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ function isWarned(emitter) {
303303
return false;
304304
});
305305

306-
// duplicate lines are removed from history when `options.deDupeHistory`
307-
// is `true`
306+
// duplicate lines are removed from history when
307+
// `options.removeHistoryDuplicates` is `true`
308308
fi = new FakeInput();
309309
rli = new readline.Interface({
310310
input: fi,
311311
output: fi,
312312
terminal: true,
313-
deDupeHistory: true
313+
removeHistoryDuplicates: true
314314
});
315315
expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
316316
callCount = 0;
@@ -333,14 +333,14 @@ function isWarned(emitter) {
333333
assert.strictEqual(callCount, 0);
334334
rli.close();
335335

336-
// duplicate lines are not removed from history when `options.deDupeHistory`
337-
// is `false`
336+
// duplicate lines are not removed from history when
337+
// `options.removeHistoryDuplicates` is `false`
338338
fi = new FakeInput();
339339
rli = new readline.Interface({
340340
input: fi,
341341
output: fi,
342342
terminal: true,
343-
deDupeHistory: false
343+
removeHistoryDuplicates: false
344344
});
345345
expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
346346
callCount = 0;

0 commit comments

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