From 9c15b76a7a438bdb54981b9013e90633115f6543 Mon Sep 17 00:00:00 2001 From: b1ek Date: Thu, 23 Mar 2023 09:43:20 +1000 Subject: [PATCH] guide command --- src/emulator/commands/guide.js | 35 ++++++++++++++++++++++++++++++++++ src/emulator/commands/index.js | 5 ++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/emulator/commands/guide.js diff --git a/src/emulator/commands/guide.js b/src/emulator/commands/guide.js new file mode 100644 index 0000000..b369945 --- /dev/null +++ b/src/emulator/commands/guide.js @@ -0,0 +1,35 @@ +module.exports = (argv, terminal) => { + if (argv.indexOf('--help') != -1) { + terminal.write( +`Usage: ${argv[0]} [-r] +Print out the guide how to use the terminal + -r \t Undocumented feature +` + ); + return; + } + + if (argv.indexOf('-r') != -1) { + // TODO: put some easter eggs here + } + + terminal.write( +`Welcome to my resume! +This is a UNIX terminal emulator. +Most of the basic unix commands are available (ls, cat, rm, mkdir, etc) + +Although you may not be a unix user so heres a quick summary what command does what: +ls \t- List files in directory +cat \t- Read file contents to terminal +rm \t- Remove file contents +mkdir \t- Create directory +wget \t- Download file from internet (more: wget --help) +ps \t- List processes +l \t- alias to ls -al + +Also there are some custom defined commands which are somewhat more fun: +guide \t- Show you this menu +skills \t- My skills info +` + ); +} \ No newline at end of file diff --git a/src/emulator/commands/index.js b/src/emulator/commands/index.js index 77a4689..afcc3fa 100644 --- a/src/emulator/commands/index.js +++ b/src/emulator/commands/index.js @@ -4,7 +4,6 @@ let cmds = { 'cmdls': require('./cmds'), 'help': require('./cmds'), 'ls': require('./ls'), - 'skills': require('./skills'), 'mkdir': require('./mkdir'), 'wget': require('./wget'), 'export_file': require('./export_file'), @@ -14,6 +13,10 @@ let cmds = { 'clear': require('./clear'), 'rm': require('./rm'), + + 'guide': require('./guide'), + 'skills': require('./skills'), + // alias l='ls -l' 'l': (a,t) => {require('./ls')([...a, '-l'], t)}, };