Making our OS - Command Line

What is a command line?
Before we go any further, I want to clear up any confusion as to what a command line is. A command line is a basic user input interface where the user inputs a specific command, and the system executes a function based on that command. If you've ever used the command prompt in Windows or the Terminal in Mac, you would know what I'm talking about. Type  and the command prompt will "echo"   Let's continue.

Creating the basic commands
I have a list of basic commands any command line should have, in my opinion:


 * SHUTDOWN (-r): Shuts the computer down, -r will reboot.


 * CLS/CLEAR: Clears the screen (Your choice)


 * ECHO: Echoes a line of text.


 * COLOR [Hexadecimal/Name]: Changes the color of the text (I prefer name, but you want to choose hexadecimal, I'm fine with it. If you don't know what hexadecimals are, look it up. It's really cool.)


 * DIR: Lists the files and directories (I will show you how, along with the rest of the commands. You do need System.IO for some of these commands)


 * CD: Goes to specified directory (Need System.IO)


 * PRINT: Prints the file contents (Doesn't run executables)


 * WRITE/(Name of Writing Application): Writes text to a file (WRITE can be substituted with the name of your writing application, if you have one)

All of these commands and descriptions can be combined into one HELP command to give the user a list of commands.

Command Line
Put this in your Run Statement:

Echo Command
In your Run Statement, instead of doing:: do:

DIR Command
First, put this in the Run : A foreach statement like this will list all items in the files directory

foreach (var item in dirs) {

Console.WriteLine(item);

}

This won't do much yet because we haven't made the filesystem yet.

After your Run add this code

private string[] GetDirFadr(string adr) // Get Directories From Address

{

var dirs = Directory.GetDirectories(adr);

return dirs;

}

Then you are good to go, just know, the dir command won't work unless you have done the FileSystem.

If you did all of this correctly, when you boot up your OS, it should come up with. Then, you can type HELP, or another function, and watch the magic happen.