Skip to content

Commit

Permalink
feat. up to cake 2.10.24, the latest version of cakephp
Browse files Browse the repository at this point in the history
  • Loading branch information
nivcoo committed Aug 28, 2021
1 parent 3dce2fd commit ed23d52
Show file tree
Hide file tree
Showing 13 changed files with 8,497 additions and 8,564 deletions.
238 changes: 119 additions & 119 deletions lib/Cake/Console/Command/CompletionShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,138 +18,138 @@

/**
* Provide command completion shells such as bash.
*
*
* @package Cake.Console.Command
*/
class CompletionShell extends AppShell {

/**
* Contains tasks to load and instantiate
*
* @var array
*/
public $tasks = array('Command');
/**
* Contains tasks to load and instantiate
*
* @var array
*/
public $tasks = array('Command');

/**
* Echo no header by overriding the startup method
*
* @return void
*/
public function startup() {
}
/**
* Echo no header by overriding the startup method
*
* @return void
*/
public function startup() {
}

/**
* Not called by the autocomplete shell - this is for curious users
*
* @return void
*/
public function main() {
return $this->out($this->getOptionParser()->help());
}
/**
* Not called by the autocomplete shell - this is for curious users
*
* @return void
*/
public function main() {
return $this->out($this->getOptionParser()->help());
}

/**
* list commands
*
* @return void
*/
public function commands() {
$options = $this->Command->commands();
return $this->_output($options);
}
/**
* list commands
*
* @return void
*/
public function commands() {
$options = $this->Command->commands();
return $this->_output($options);
}

/**
* list options for the named command
*
* @return void
*/
public function options() {
$commandName = '';
if (!empty($this->args[0])) {
$commandName = $this->args[0];
}
$options = $this->Command->options($commandName);
/**
* list options for the named command
*
* @return void
*/
public function options() {
$commandName = '';
if (!empty($this->args[0])) {
$commandName = $this->args[0];
}
$options = $this->Command->options($commandName);

return $this->_output($options);
}
return $this->_output($options);
}

/**
* list subcommands for the named command
*
* @return void
*/
public function subCommands() {
if (!$this->args) {
return $this->_output();
}
/**
* list subcommands for the named command
*
* @return void
*/
public function subCommands() {
if (!$this->args) {
return $this->_output();
}

$options = $this->Command->subCommands($this->args[0]);
return $this->_output($options);
}
$options = $this->Command->subCommands($this->args[0]);
return $this->_output($options);
}

/**
* Guess autocomplete from the whole argument string
*
* @return void
*/
public function fuzzy() {
return $this->_output();
}
/**
* Guess autocomplete from the whole argument string
*
* @return void
*/
public function fuzzy() {
return $this->_output();
}

/**
* Gets the option parser instance and configures it.
*
* @return ConsoleOptionParser
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
/**
* Gets the option parser instance and configures it.
*
* @return ConsoleOptionParser
*/
public function getOptionParser() {
$parser = parent::getOptionParser();

$parser->description(
__d('cake_console', 'Used by shells like bash to autocomplete command name, options and arguments')
)->addSubcommand('commands', array(
'help' => __d('cake_console', 'Output a list of available commands'),
'parser' => array(
'description' => __d('cake_console', 'List all availables'),
'arguments' => array(
)
)
))->addSubcommand('subcommands', array(
'help' => __d('cake_console', 'Output a list of available subcommands'),
'parser' => array(
'description' => __d('cake_console', 'List subcommands for a command'),
'arguments' => array(
'command' => array(
'help' => __d('cake_console', 'The command name'),
'required' => true,
)
)
)
))->addSubcommand('options', array(
'help' => __d('cake_console', 'Output a list of available options'),
'parser' => array(
'description' => __d('cake_console', 'List options'),
'arguments' => array(
'command' => array(
'help' => __d('cake_console', 'The command name'),
'required' => false,
)
)
)
))->epilog(
__d('cake_console', 'This command is not intended to be called manually')
);
$parser->description(
__d('cake_console', 'Used by shells like bash to autocomplete command name, options and arguments')
)->addSubcommand('commands', array(
'help' => __d('cake_console', 'Output a list of available commands'),
'parser' => array(
'description' => __d('cake_console', 'List all availables'),
'arguments' => array(
)
)
))->addSubcommand('subcommands', array(
'help' => __d('cake_console', 'Output a list of available subcommands'),
'parser' => array(
'description' => __d('cake_console', 'List subcommands for a command'),
'arguments' => array(
'command' => array(
'help' => __d('cake_console', 'The command name'),
'required' => true,
)
)
)
))->addSubcommand('options', array(
'help' => __d('cake_console', 'Output a list of available options'),
'parser' => array(
'description' => __d('cake_console', 'List options'),
'arguments' => array(
'command' => array(
'help' => __d('cake_console', 'The command name'),
'required' => false,
)
)
)
))->epilog(
__d('cake_console', 'This command is not intended to be called manually')
);

return $parser;
}
return $parser;
}

/**
* Emit results as a string, space delimited
*
* @param array $options The options to output
* @return void
*/
protected function _output($options = array()) {
if ($options) {
return $this->out(implode($options, ' '));
}
}
}
/**
* Emit results as a string, space delimited
*
* @param array $options The options to output
* @return void
*/
protected function _output($options = array()) {
if ($options) {
return $this->out(implode(' ', $options));
}
}
}
Loading

0 comments on commit ed23d52

Please sign in to comment.