Add local-echo

cpsdqs/unified-input
cpsdqs 7 years ago
parent 758d3c58a6
commit 8d994009fb
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 15
      js/demo.js

@ -325,7 +325,7 @@ let demoshIndex = {
clear: class Clear extends Process { clear: class Clear extends Process {
run () { run () {
this.emit('write', '\x1b[2J\x1b[1;1H') this.emit('write', '\x1b[2J\x1b[1;1H')
this.emit('exit') this.destroy()
} }
}, },
screenfetch: class Screenfetch extends Process { screenfetch: class Screenfetch extends Process {
@ -358,6 +358,11 @@ let demoshIndex = {
} }
loop() loop()
} }
},
'local-echo': class LocalEcho extends Process {
write (data) {
this.emit('write', data)
}
} }
} }
@ -414,9 +419,13 @@ class DemoShell {
if (action === 'return') { if (action === 'return') {
this.terminal.write('\r\n') 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) { run (command) {
let parts = [''] let parts = ['']
@ -451,7 +460,7 @@ class DemoShell {
this.child = null this.child = null
this.prompt(!code) this.prompt(!code)
}) })
this.child.run() this.child.run(...args)
} }
} }

Loading…
Cancel
Save