From 8d994009fb964a20234e78dd9e71fef1b2b87486 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Mon, 11 Sep 2017 23:24:56 +0200 Subject: [PATCH] Add local-echo --- js/demo.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/demo.js b/js/demo.js index 265b88e..6422e83 100644 --- a/js/demo.js +++ b/js/demo.js @@ -325,7 +325,7 @@ let demoshIndex = { clear: class Clear extends Process { run () { this.emit('write', '\x1b[2J\x1b[1;1H') - this.emit('exit') + this.destroy() } }, screenfetch: class Screenfetch extends Process { @@ -358,6 +358,11 @@ let demoshIndex = { } loop() } + }, + 'local-echo': class LocalEcho extends Process { + write (data) { + this.emit('write', data) + } } } @@ -414,9 +419,13 @@ class DemoShell { if (action === 'return') { this.terminal.write('\r\n') - this.run(this.input) + this.parse(this.input) } } + parse (input) { + // TODO: basic chaining (i.e. semicolon) + this.run(input) + } run (command) { let parts = [''] @@ -451,7 +460,7 @@ class DemoShell { this.child = null this.prompt(!code) }) - this.child.run() + this.child.run(...args) } }