The Console System
Introduction
This page will go over the basics on how to use this console system, as an end-user, using the default configuration. To try it out, build and compile the example program. On it's own, it doesn't really do much, as it is supposed to be implemented into a host application. The example program will just launch a window, which you can use to interact with the console system.
If you want, you can check our application MCN Launch Pad as an example host application, which uses a version of this library.
When launching the test application, you should see a basic, terminal-like window, with a big text field, representing the console output buffer, and a Command input text field at the bottom of the window. Use the Command input text field to submit commands to the console. You can just enter your command and hit the Enter-key to submit it, or click on the Submit button.
The interface is simple, but may differ depending on the host application.
Submitting your first commands
As a form of "Hello World" equivalent, lets learn 2 basic commands to get you started.
CLEAR Command
The first command that we'll learn is the CLEAR command. This command clears the console buffer and when you submit that command, all what's currently on the output buffer will be cleared and you should only see something like displayed below:
Application Name, Command System Interface.
Version 1.0.0, Build X.
Ready...
Note that you don't need to write your commands in all-uppercase. In the documentation, however, you'll see all command-keywords written as all-uppercase because of a convention we use to make it clear to you that this is a command.
The "Ready" prompt that you see above signifies the user that the command system is ready to receive commands. The display of the clear-text (which is the text displayed after submitting the CLEAR command) may depend on the host application, and may contain different information about the application itself.
ECHO command
The ECHO command is used to print text to the output buffer, which will in turn who up on the screen. This action is called "echoing". Echoing or printing text on to the console is something fundamentally basic, but important, as it provides feedback to the end user. This command is very useful in configuration scripts to let the user know what's going on and can help you understand the current state of things of something goes wrong.
Unlike the CLEAR command, which is just CLEAR without any additional arguments, the ECHO command accepts one parameter, which is the text that you want to print out.
The syntax of this line is as followed: ECHO [String: Text]
In the syntax, we can see that the parameter 'Text' is in between angled brackets "[...]", which signifies an optional parameter. An optional parameter does not need to be specified and can be left out. To test this command out, submit just ECHO twice:
> ECHO
> ECHO
The empty line is apparent, because there is a vertical space between the two echoed commands. Of course, printing an empty line is not something you will typically do. You'll most likely want to print some text to the console. Let's try printing “Hello World” on to the console by sending the following command:
> ECHO "Hello World"
Hello World
Note that “Hello World” is between double quotes. This important, as this will encapsulate the “Hello World” string literal as one single argument to the ECHO-command. If you were to send the same command, but without the double quotes, you'll get “Hello” as output, and “World” has been left out. This is because the system parsed the “World” part as one additional parameter, and since the ECHO-command only accepts one parameter, everything that follows, is ignored.
> ECHO Hello World
Hello
So, take good care of your parameters when you submit them to the console.