joyent/node — pull request #2086 by seebees (2011-11-13 02:07:08+00:00)
Title: test for REPL .save and .load and documentation updates

@ry here are tests for .save and .load and some documentation updates for #2063

@indutny I create an instance of magic for each `complete()` request because I was worried about some kind of crazy race condition. What I am doing is a little... out there and I did not want to push the envelop. But if you tell me that I can use only one for each type ahead request and then clear it, some thing like this in the constructor

```
var flat = new ArrayStream();
self.magic = new REPLServer('', flat);
self.magic.flat = flat;
```

and this in `complete`

```
this.magic.flat.run(['.clear']);
this.magic.flat.run(tmp);
if (!this.magic.bufferedCommand) {
return this.magic.complete(line, function() {
self.magic.flat.run(['.clear']); // to clear the stored lines
callback.apply(arguments);
});
}
```
then I'm all ears.