Command

Represents one program command which identified the expected string on the command line. One of more of these can be given to a ProgramCommands object as template arguments.

The Command object is accessible from a ProgramCommands object via the name given to the command.

If the name is not a valid identifier, it is transformed in to camel case by the following rules: <ol> <li> if first character is invalid first character for identifier, it is skipped. <li> if any following character is not a valid identifier character, it is skipped AND the next valid character is capitalized. </ol>

template Command (
string name
) if (
name.length > 0
) {}

Parameters

name

The name of the command.

Named optional arguments

A number of named optional arguments can be given to a Command for e.g.:

ProgramCommands!(
    Command!"push".description!"This command pushes all your bases belongs to us"
);

This will create a commands object that can parse a command push on the command line.

The following named optional arguments are available:

<li>description: string - description for help message <li>args: $(DDOX_NAMED_REF dcli.program_options, `ProgramOptions`)|ProgramCommands - this can be given a set of program options that can be used with this command, or it can be given a program commands object so that it has sub commands <li>handler: void function(T) - this is a handler function that will only be called if this command was present on the command line. The type T passed in will be your ProgramCommands structure instance

Meta