Overview

Namespaces

  • None
  • Peg
    • Cli
      • Commands
    • Config
    • Custom
      • Command
        • Action
          • Generate
          • Parse
      • CommandLine
      • Config
      • Localization
      • Utilities
    • Lib
      • Definitions
        • Element
      • Generator
      • Lexers
      • Plugins
      • Signals
        • Data
          • Definitions
          • Lexers
        • Type
  • PHP

Classes

  • Action
  • Command
  • Error
  • Option
  • OptionType
  • Parser
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

Class Command

A sub command processed by the application. Example peg init

Direct known subclasses

Peg\Custom\Command\Generate, Peg\Custom\Command\Help, Peg\Custom\Command\Init, Peg\Custom\Command\Parse
Namespace: Peg\Custom\CommandLine
Located at src/CommandLine/Command.php
Methods summary
public
# __construct( string $name, Peg\Custom\CommandLine\Option[] $options = array(), Peg\Custom\CommandLine\Action[] $actions = array() )

Initialize the command.

Initialize the command.

Parameters

$name
string
$name Name of the Sub-command
$options
Peg\Custom\CommandLine\Option[]
$options List of options
$actions
Peg\Custom\CommandLine\Action[]
$actions List of actions
public
# AddOption( Peg\Custom\CommandLine\Option $option )

Define a new option accepted by the command.

Define a new option accepted by the command.

Parameters

$option
Peg\Custom\CommandLine\Option
$option
public null|Peg\Custom\CommandLine\Option
# GetOption( type $name )

Gets an option by its long or short name.

Gets an option by its long or short name.

Parameters

$name
type
$name

Returns

null|Peg\Custom\CommandLine\Option
public
# Execute( )

Execute each action associated to the command.

Execute each action associated to the command.

public
# RegisterAction( Peg\Custom\CommandLine\Action $action )

Register actions that get call when command is executed.

Register actions that get call when command is executed.

Parameters

$action
Peg\Custom\CommandLine\Action
$action
Properties summary
public string $name
#

Name of the command.

Name of the command.

public string $description
#

Description of the command displayed on help.

Description of the command displayed on help.

public Peg\Custom\CommandLine\Option[] $options
#

Array of Options processed by the command.

Array of Options processed by the command.

public string $value
#

In case the command supports values. Example: peg init something where 'init' is the command and 'something' is the value.

In case the command supports values. Example: peg init something where 'init' is the command and 'something' is the value.

public boolean $value_required
#

Flag that indicates if a value is required for the command.

Flag that indicates if a value is required for the command.

public Peg\Custom\CommandLine\Action[] $actions
#

Array of Actions called if this command gets executed.

Array of Actions called if this command gets executed.

PEG Api API documentation generated by ApiGen 2.8.0