From 5bda5faffdeefa448965159e524eacdd14490436 Mon Sep 17 00:00:00 2001 From: Danny Nemer Date: Mon, 21 Sep 2015 10:08:36 -0400 Subject: readline: add option to stop duplicates in history Adds `options.deDupeHistory` for `readline.createInterface(options)`. If `options.deDupeHistory` is `true`, when a new input line being added to the history list duplicates an older one, removes the older line from the list. Defaults to `false`. Many users would appreciate this option, as it is a common setting in shells. This option certainly should not be default behavior, as it would be problematic in applications such as the `repl`, which inherits from the readline `Interface`. Extends documentation to reflect this API addition. Adds tests for when `options.deDupeHistory` is truthy, and when `options.deDupeHistory` is falsey. PR-URL: https://github.com/nodejs/node/pull/2982 Reviewed-By: Jeremiah Senkpiel --- doc/api/readline.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/api/readline.md') diff --git a/doc/api/readline.md b/doc/api/readline.md index 878721bb4d..e471daecae 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -370,6 +370,9 @@ changes: `crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate end-of-line input. Default to `100` milliseconds. `crlfDelay` will be coerced to `[100, 2000]` range. + * `deDupeHistory` {boolean} If `true`, when a new input line added to the + history list duplicates an older one, this removes the older line from the + list. Defaults to `false`. The `readline.createInterface()` method creates a new `readline.Interface` instance. -- cgit v1.2.3