Skip to content
Alexandru Maftei edited this page Jun 5, 2014 · 6 revisions

The main purpose of vCommands is to provide applications with an easy way to execute textual commands.

If you have an idea of how such console commands generally work, take a look at the test code. It may speak louder to you than any text.

vCommands includes a thoroughly-tested tokenizer and parser. The tokenizer takes a string and enumerates every token inside it, while the parser builds an expression tree from a sequence of tokens.
The code is explained in the Parser page.

The "main" class of the library is vCommands.Host, which accounts for all the commands, variables and manuals and also handles textual executions. Currently, they also store aliases and user commands.

Inspiration

A large portion of my code is centered around Garry's Mod, a Source engine-based game.

The Source engine includes a developer console (accessible through the ~ key) where a user is allowed to execute certain commands, such as status for listing the server status, changelevel to change the current map, maxplayers to set the maximum players on the server, fps_max to change the maximum number of frames per second, etc.

This makes development especially easy, because it can allow (secure) low-level access into a system but also the possibility to configure most things in the software through the use of ConVars, a wrapper around commands to turn them into variables which can be very efficiently accessed in the code.

vCommands employs the same syntax for raw commands (including the "togglers", + and -), but I decided to not "implement" the bugs too. The separator between invocations (;) is also borrowed from Source.

Bash also influenced the syntax. I decided to use square brackets ([ and ]) to wrap compound arguments, which are simply a way to pipe a command's output into another command as argument.

C-like languages (including C# itself) are the inspiration for the conditional structure.

Further read

Check out the Syntax page for information about the syntax of commands.

Clone this wiki locally