Add option to set prompt for server
This commit is contained in:
parent
246935bde6
commit
14f825cb51
@ -5,6 +5,7 @@ const repl = require('repl');
|
|||||||
|
|
||||||
const DEFAULT_HOST = "localhost";
|
const DEFAULT_HOST = "localhost";
|
||||||
const DEFAULT_PORT = 3456;
|
const DEFAULT_PORT = 3456;
|
||||||
|
const DEFAULT_PROMPT = "> ";
|
||||||
|
|
||||||
const CRed = "\x1b[31m";
|
const CRed = "\x1b[31m";
|
||||||
const CYellow = "\x1b[33m";
|
const CYellow = "\x1b[33m";
|
||||||
@ -135,7 +136,7 @@ const startServer = (options) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Start a node repl
|
// Start a node repl
|
||||||
const r = repl.start({prompt: "> "});
|
const r = repl.start({prompt: options.prompt});
|
||||||
r.defineCommand('show', {
|
r.defineCommand('show', {
|
||||||
help: '[TERMLOG] Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by `,`',
|
help: '[TERMLOG] Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by `,`',
|
||||||
action(arg) {
|
action(arg) {
|
||||||
@ -171,6 +172,9 @@ Options:
|
|||||||
--out arg
|
--out arg
|
||||||
Save output to file
|
Save output to file
|
||||||
|
|
||||||
|
--primpt arg
|
||||||
|
Sets promt, "" to disable
|
||||||
|
|
||||||
--show args
|
--show args
|
||||||
Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by \`,\`
|
Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by \`,\`
|
||||||
|
|
||||||
@ -183,6 +187,7 @@ Options:
|
|||||||
port: DEFAULT_PORT,
|
port: DEFAULT_PORT,
|
||||||
host:DEFAULT_HOST,
|
host:DEFAULT_HOST,
|
||||||
show: LOGLEVELS,
|
show: LOGLEVELS,
|
||||||
|
prompt: DEFAULT_PROMPT,
|
||||||
...args
|
...args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user