Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commands are objects that contain all of the data necessary to execute a specific action on the client. The commander doesn't need to know how to execute each piece a specific action. Each command is different, they contain different parts and different instructions. The index.js file contains a code where we can incorporate a command pattern. It builds the prompt using the create interface method from read line. And our process standard input and process standard output is going to be our interface. And on line eight we are adding our first prompt. Whenever the user enters any text we go ahead and handle it. Lines 11-13 are just a matter of parsing that text to find the command and the actual file name or a file text that would go into that command. And finally, we have a switch statement where we are ready to run our commands. So if we run an Exit, we've left ourselves a little to do for adding an Exit command; and if we run a Create, we've left ourselves a little to do for running a Create command. So we've already parsed the file name and the text that would go into the file that needs to be created for the user. And also if the user don't run either of these commands, is just let the user know that it don't know what the user is trying to do.
- Loading branch information