Created
June 15, 2012 09:48
-
-
Save josher19/2935659 to your computer and use it in GitHub Desktop.
Add to repl to search through history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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