From d44dce766b4a942e434b927566bf3229ac6c1ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Thu, 14 Sep 2017 22:44:46 +0200 Subject: [PATCH] added a very important demo command --- _build_js.sh | 8 ++------ js/demo.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/_build_js.sh b/_build_js.sh index 7122d5e..fa03512 100755 --- a/_build_js.sh +++ b/_build_js.sh @@ -5,17 +5,13 @@ mkdir -p out/js echo 'Generating lang.js...' php ./dump_js_lang.php -if [[ $ESP_DEMO ]]; then - demofile=js/demo.js -else - demofile= -fi - echo 'Processing JS...' if [[ $ESP_PROD ]]; then smarg= + demofile= else smarg=--source-maps + demofile=js/demo.js fi npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" ${smarg} js/lib \ diff --git a/js/demo.js b/js/demo.js index 37cd24f..3d4ed4d 100644 --- a/js/demo.js +++ b/js/demo.js @@ -680,6 +680,43 @@ let demoshIndex = { super.destroy() } }, + sudo: class Sudo extends Process { + run (...args) { + if (args.length === 0) this.emit('write', 'usage: sudo ') + else if (args.length === 4 && args.join(' ').toLowerCase() === 'make me a sandwich') { + this.emit('write', ' _.---._\r\n' + + ' _.-~ ~-._\r\n' + + ' _.-~ ~-._\r\n' + + ' _.-~ ~---._\r\n' + + ' _.-~ ~\\\r\n' + + ' .-~ _.;\r\n' + + ' :-._ _.-~ ./\r\n' + + ' `-._~-._ _..__.-~ _.-~\r\n' + + ' / ~-._~-._ / .__..--~----._\r\n' + + ' \\_____(_;-._\\. _.-~_/ ~).. . \\\r\n' + + ' /(_____ \\`--...--~_.-~______..-+_______)\r\n' + + ' .(_________/`--...--~/ _/ /\\\r\n' + + ' /-._ \\_ (___./_..-~__.....__..-~./\r\n' + + ' `-._~-._ ~\\--------~ .-~_..__.-~ _.-~\r\n' + + ' ~-._~-._ ~---------\' / .__..--~\r\n' + + ' ~-._\\. _.-~_/\r\n' + + ' \\`--...--~_.-~\r\n' + + ' `--...--~\r\n') + } + this.destroy() + } + }, + make: class Make extends Process { + run (...args) { + if (args.length === 0) this.emit('write', '\x1b[31mmake: *** No targets specified. Stop.\x1b[0m\r\n') + else if (args.length === 3 && args.join(' ').toLowerCase() === 'me a sandwich') { + this.emit('write', '\x1b[31mmake: me a sandwich : Permission denied\x1b[0m\r\n') + } else { + this.emit('write', `\x1b[31mmake: *** No rule to make target '${args.join(' ').toLowerCase()}'. Stop.\x1b[0m\r\n`) + } + this.destroy() + } + }, pwd: '/this/is/a/demo\r\n', cd: '\x1b[38;5;239mNo directories to change to\r\n', whoami: `${window.navigator.userAgent}\r\n`,