diff options
author | isaacs <i@izs.me> | 2011-10-17 18:24:12 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-10-18 18:18:32 -0700 |
commit | b70fed48a7fb0ac884e6574253a89db6158b2f60 (patch) | |
tree | e3e9acd3b36df1892133a6211ef867267e330e4c /doc | |
parent | 200df8641b43902adc73cce6b89d3e84a91dd3e6 (diff) | |
download | node-b70fed48a7fb0ac884e6574253a89db6158b2f60.tar.gz |
Don't use a separate context for the repl.
Fix #1484
Fix #1834
Fix #1482
Fix #771
It's been a while now, and we've seen how this separate context thing
works. It constantly confuses people, and no one actually uses '.clear'
anyway, so the benefit of that feature does not justify the constant
WTFery.
This makes repl.context actually be a getter that returns the global
object, and prints a deprecation warning. The '.clear' command is gone,
and will report that it's an invalid repl keyword. Tests updated to
allow the require, module, and exports globals, which are still
available in the repl just like they were before, by making them global.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/repl.markdown | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/doc/api/repl.markdown b/doc/api/repl.markdown index c0b9789e1..7bce1f7e5 100644 --- a/doc/api/repl.markdown +++ b/doc/api/repl.markdown @@ -83,28 +83,12 @@ The special variable `_` (underscore) contains the result of the last expression > _ += 1 4 -The REPL provides access to any variables in the global scope. You can expose -a variable to the REPL explicitly by assigning it to the `context` object -associated with each `REPLServer`. For example: - - // repl_test.js - var repl = require("repl"), - msg = "message"; - - repl.start().context.m = msg; - -Things in the `context` object appear as local within the REPL: - - mjr:~$ node repl_test.js - > m - 'message' +The REPL provides access to any variables in the global scope. There are a few special REPL commands: - `.break` - While inputting a multi-line expression, sometimes you get lost or just don't care about completing it. `.break` will start over. - - `.clear` - Resets the `context` object to an empty object and clears any - multi-line expression. - `.exit` - Close the I/O stream, which will cause the REPL to exit. - `.help` - Show this list of special commands. |