You're right jules, one a day! :hihi:
This morning's challenge: old school flavour
This is in two parts, heavily commented and very easy to use.
CommandLineSystem forms a base that defines what the command line can do. CommandLineComponent provides a text output space and a user input field.
Demo: CommandLineTest windows build
Source: CommandLine source & VC++e project
Lots of stuff is done automatically. The system has a startup message, 'help' keywords (which display the known commands), an array of known commands, automatic separation of a command from its parameters, the option to keep the command as a single string, optional ignoring of unknown parameters, etc...
A virtual 'processCommand' function is called with the command [string], parameters [string array] and the originating CommandLineComponent's pointer. If you've set it to ignore unknown commands, this will only be called for known commands. This is where you define the behaviour of your system.
If you've set it to preserve the command string, the splitting into command/parameters is not done, and the command (and the pointer to the component) is passed to the virtual 'processCommandString' function.
See the comments for more information.
