core: logger upd

This commit is contained in:
undefined committed 2020-12-21 03:06:41 +08:00
1 parent d4088f429a
commit 4d031eb9ab
9 files changed
+141 -131

No files matched your search

+15
View File
@@ -51,7 +51,11 @@ if (cluster.isMaster) {
bus.on('message/log', (message) => {
LogBox.appendLog(message);
});
const history = [''];
let current = 0;
ShellInput.on('submit', async (input) => {
history.push(input);
current = history.length;
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
ShellInput.input.setContent('', false, false);
if (input[0] === '@') {
@@ -61,6 +65,17 @@ if (cluster.isMaster) {
}
} else bus.parallel('message/run', input);
});
ShellInput.on('key', (key) => {
if (key === 'UP') {
current--;
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
ShellInput.input.setContent(history[current] || '', false, false);
} else if (key === 'DOWN') {
current++;
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
ShellInput.input.setContent(history[current] || '', false, false);
}
});
terminal.on('key', (key, matches, data) => {
if (key === 'CTRL_C') terminate();
});