mirror of https://github.com/embarklabs/embark.git
Add dedicated writer for string result
This commit is contained in:
parent
d5911cb3b7
commit
36ae882a26
|
@ -1,4 +1,5 @@
|
|||
const repl = require("repl");
|
||||
const util = require("util");
|
||||
|
||||
const Console = require('./console.js');
|
||||
|
||||
|
@ -20,11 +21,20 @@ class REPL {
|
|||
});
|
||||
}
|
||||
|
||||
enhancedWriter(output) {
|
||||
if ((typeof output) === "string") {
|
||||
return output;
|
||||
} else {
|
||||
return util.inspect(output, {colors: true});
|
||||
}
|
||||
}
|
||||
|
||||
start(done) {
|
||||
this.replServer = repl.start({
|
||||
prompt: "Embark (" + this.env + ") > ",
|
||||
useGlobal: true,
|
||||
eval: this.enhancedEval.bind(this)
|
||||
eval: this.enhancedEval.bind(this),
|
||||
writer: this.enhancedWriter.bind(this)
|
||||
});
|
||||
|
||||
this.replServer.on("exit", () => {
|
||||
|
|
Loading…
Reference in New Issue