Skip to content

Instantly share code, notes, and snippets.

@josher19
Created June 15, 2012 09:48
Show Gist options
  • Save josher19/2935659 to your computer and use it in GitHub Desktop.
Save josher19/2935659 to your computer and use it in GitHub Desktop.
Add to repl to search through history
repl.defineCommand('search', {
help: 'search through repl history',
action: function(cmd) {
if (this.rli.history) this.outputStream.write(this.rli.history.filter(function(line,n) {return n && -1 !== line.indexOf(cmd)}).reverse().join("\n")+"\n");
this.displayPrompt();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment