diff --git a/src/pages/index/indexConsole/commands.js b/src/pages/index/indexConsole/commands.js index cdc5e0a..49810cf 100644 --- a/src/pages/index/indexConsole/commands.js +++ b/src/pages/index/indexConsole/commands.js @@ -1,11 +1,12 @@ import React from 'react' const help = () => { - return "register - register user by form \n" - + "login - login user by form \n" - + "logout - logout user \n" - + "start - start command \n" - + " -a --app - app flag - start music service app \n" + return "register - register user by form \n" + + "login - login user by form \n" + + "logout - logout user \n" + + "start - start command \n" + + " -a --app - app flag - start music service app \n" + + "clean - clean screen \n" } const register = () => { @@ -41,11 +42,8 @@ const startApp = () => { } const undefined = (command) => { - return ( -
- command '{command}' is undefined -
- ) + return 'command "'+ command + '" is undefined\n' + + ' type "help" for more commands\n' } export default { diff --git a/src/pages/index/indexConsole/indexConsole.js b/src/pages/index/indexConsole/indexConsole.js index 6e4675f..543cd8b 100644 --- a/src/pages/index/indexConsole/indexConsole.js +++ b/src/pages/index/indexConsole/indexConsole.js @@ -22,26 +22,35 @@ const IndexConsole = () => { const consoleInput = React.createRef() + let consoleUser = 'guest@00x097 * > ' + const detectCommand = (event) => { event.preventDefault() - setConsoleHistory( '# ' + consoleInput.current.value + '\n') - if (consoleInput.current.value === 'help') - setConsoleHistory( commands.help() ) - console.log(consoleHistory) + let inputValue = consoleInput.current.value + consoleUser += inputValue + '\n' + if ( inputValue === 'help' ) + setConsoleHistory( consoleHistory + consoleUser + commands.help() ) + else if ( inputValue === 'clean' ) + setConsoleHistory( '' ) + else + setConsoleHistory( consoleHistory + consoleUser + commands.undefined(inputValue) ) + consoleInput.current.value = '' activateInput() } return (
-
- tbs093a@00x097 system, welcome
- type 'help' to get commands +
+ 00x097 system (Version 0.1.9)
+ type 'help' for more commands
+ type 'start -a' for start app +

                     { consoleHistory }
             
- # + guest@00x097 * >