public function addSubcommand($name, array $options = [])
    {
        if ($name instanceof ConsoleInputSubcommand) {
            $command = $name;
            $name = $command->name();
        } else {
            $name = Inflector::underscore($name);
            $defaults = [
                'name' => $name,
                'help' => '',
                'parser' => null
            ];
            $options += $defaults;

            $command = new ConsoleInputSubcommand($options);
        }
        $this->_subcommands[$name] = $command;
        if ($this->_subcommandSort) {
            asort($this->_subcommands);
        }

        return $this;
    }
public function addSubcommand($name, array $options = [])
    {
        if ($name instanceof ConsoleInputSubcommand) {
            $command = $name;
            $name = $command->name();
        } else {
            $name = Inflector::underscore($name);
            $defaults = [
                'name' => $name,
                'help' => '',
                'parser' => null
            ];
            $options += $defaults;

            $command = new ConsoleInputSubcommand($options);
        }
        $this->_subcommands[$name] = $command;
        if ($this->_subcommandSort) {
            asort($this->_subcommands);
        }

        return $this;
    }
public function addSubcommand ( $ name , array $ options = [ ] ) { if ( $ name instanceof ConsoleInputSubcommand ) { $ command = $ name ; $ name = $ command -> name ( ) ; } else { $ name = Inflector :: underscore ( $ name ) ; $ defaults = [ 'name' => $ name , 'help' => '' , 'parser' => null ] ; $ options += $ defaults ; $ command = new ConsoleInputSubcommand ( $ options ) ; } $ this -> _subcommands [ $ name ] = $ command ; if ( $ this -> _subcommandSort ) { asort ( $ this -> _subcommands ) ; } return $ this ; }
Append a subcommand to the subcommand list.
Subcommands are usually methods on your Shell, but can also be used to document Tasks.

### Options

- `help` - Help text for the subcommand.
- `parser` - A ConsoleOptionParser for the subcommand. This allows you to create method
specific option parsers. When help is generated for a subcommand, if a parser is present
it will be used.

@param \Cake\Console\ConsoleInputSubcommand|string $name Name of the subcommand. Will also accept an instance of ConsoleInputSubcommand
@param array $options Array of params, see above.
@return $this
Append a subcommand to the subcommand list . Subcommands are usually methods on your Shell but can also be used to document Tasks .