readline: add option to stop duplicates in history
Checklist
-
tests and code linting passes -
a test and/or benchmark is included -
documentation is changed or added -
the commit message follows commit guidelines
Affected core subsystem(s)
readline
Description of change
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
.
To clarify, this option is for instantiating a new readline Interface
; it is not for the Node REPL. The REPL inherits from Interface
, but is unaffected (as is any existing Interface
implementation) because this option defaults to false
.
Many users would appreciate this option for creating RLIs, as it is a common setting in shells. (This setting is availble in bash, zsh, and enabled by default for fish.)
Extends documentation to reflect this API addition.
Adds tests for when options.deDupeHistory
is truthy, and when options.deDupeHistory
is falsey.