Alias 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.

alias Command(string name) = CommandImpl!(name,ProgramOptions!());

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:

  1. if first character is invalid first character for identifier, it is skipped.
  2. if any following character is not a valid identifier character, it is skipped AND the next valid character is capitalized.

Parameters

NameDescription
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:

  • description: string - description for help message
  • args: 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
  • 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