mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 09:46:37 +00:00
28 lines
501 B
JavaScript
28 lines
501 B
JavaScript
const repl = require("repl");
|
|
const RunCode = require('../coderunner/runCode');
|
|
|
|
class REPL {
|
|
constructor(options) {
|
|
this.env = options.env;
|
|
}
|
|
|
|
start(done) {
|
|
this.replServer = repl.start({
|
|
prompt: "Embark (" + this.env + ") > "
|
|
});
|
|
this.initializeContext(this.replServer.context);
|
|
|
|
this.replServer.on("exit", () => {
|
|
process.exit();
|
|
});
|
|
|
|
done();
|
|
}
|
|
|
|
initializeContext(context) {
|
|
context.embark = RunCode.getContext();
|
|
}
|
|
}
|
|
|
|
module.exports = REPL;
|