mirror of https://github.com/embarklabs/embark.git
Add dedicated writer for string result
This commit is contained in:
parent
ed9be59abe
commit
2f2626a7c8
|
@ -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