Property | Type | Description | |
---|---|---|---|
$OptionParser | Cake\Console\ConsoleOptionParser | An instance of ConsoleOptionParser that has been configured for this class. | |
$Tasks | Cake\Console\TaskRegistry | Task Collection for the command, used to create Tasks. | |
$args | array | Contains arguments parsed from the command line. | |
$command | string | The command (method/task) that is being run. | |
$interactive | boolean | If true, the script will ask for permission to perform actions. | |
$name | string | The name of the shell in camelized. | |
$params | array | Contains command switches parsed from the command line. | |
$plugin | string | Is automatically set by ShellDispatcher when a shell is constructed. | |
$taskNames | array | Contains the loaded tasks | |
$tasks | array | Contains tasks to load and instantiate |
Property | Type | Description | |
---|---|---|---|
$_io | ConsoleIo instance. | ||
$_taskMap | array | Normalized map of tasks. |
Method | Description | |
---|---|---|
__construct ( |
Constructs this Shell instance. | |
__debugInfo ( ) : array | Returns an array that can be used to describe the internal state of this object. | |
__get ( string $name ) : |
Overload get for lazy building of tasks | |
abort ( string $message, integer $exitCode = self::CODE_ERROR ) : void | Displays a formatted error message and exits the application with status code 1 | |
clear ( ) : void | Clear the console | |
createFile ( string $path, string $contents ) : boolean | Creates a file at given path | |
dispatchShell ( ) : mixed | Dispatch a command to another Shell. Similar to Object::requestAction() but intended for running shells from other shells. | |
err ( string | array | null $message = null, integer $newlines = 1 ) : integer | boolean | Outputs a single or multiple error messages to stderr. If no parameters are passed outputs just a newline. | |
error ( string $title, string | null $message = null, integer $exitCode = self::CODE_ERROR ) : integer | Displays a formatted error message and exits the application with status code 1 | |
getOptionParser ( ) : Cake\Console\ConsoleOptionParser | Gets the option parser instance and configures it. | |
hasMethod ( string $name ) : boolean | Check to see if this shell has a callable method by the given name. | |
hasTask ( string $task ) : boolean | Check to see if this shell has a task with the provided name. | |
helper ( string $name, array $settings = [] ) : Cake\Console\Helper | Render a Console Helper | |
hr ( integer $newlines, integer $width = 63 ) : void | Outputs a series of minus characters to the standard output, acts as a visual separator. | |
in ( string $prompt, string | array | null $options = null, string | null $default = null ) : mixed | Prompts the user for input, and returns it. | |
info ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean |
Convenience method for out() that wraps message between |
|
initialize ( ) : void | Initializes the Shell acts as constructor for subclasses allows configuration of tasks prior to shell execution | |
io ( |
Get/Set the io object for this shell. | |
loadTasks ( ) : boolean | Loads tasks defined in public $tasks | |
nl ( integer $multiplier = 1 ) : string | Returns a single or multiple linefeeds sequences. | |
out ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean | Outputs a single or multiple messages to stdout. If no parameters are passed outputs just a newline. | |
param ( string $name ) : string | boolean | null | Safely access the values in $this->params. | |
parseDispatchArguments ( array $args ) : array | Parses the arguments for the dispatchShell() method. | |
quiet ( string | array $message, integer $newlines = 1 ) : integer | boolean | Output at all levels. | |
runCommand ( array $argv, boolean $autoMethod = false, array $extra = [] ) : integer | boolean | null | Runs the Shell with the provided argv. | |
shortPath ( string $file ) : string | Makes absolute file path easier to read | |
startup ( ) : void | Starts up the Shell and displays the welcome message. | |
success ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean |
Convenience method for out() that wraps message between |
|
verbose ( string | array $message, integer $newlines = 1 ) : integer | boolean | Output at the verbose level. | |
warn ( string | array | null $message = null, integer $newlines = 1 ) : integer | boolean |
Convenience method for err() that wraps message between |
|
wrapText ( string $text, integer | array $options = [] ) : string | Wrap a block of text. |
Method | Description | |
---|---|---|
_displayHelp ( string $command ) : integer | boolean | Display the help in the correct format | |
_setOutputLevel ( ) : void | Set the output level based on the parameters. | |
_stop ( integer | string $status ) : void | Stop execution of the current script. | |
_welcome ( ) : void | Displays a header for the shell |
public __construct ( |
||
$io | An io instance. |
public __debugInfo ( ) : array | ||
return | array |
protected _setOutputLevel ( ) : void | ||
return | void |
public dispatchShell ( ) : mixed | ||
return | mixed | The return of the other shell. |
public getOptionParser ( ) : Cake\Console\ConsoleOptionParser | ||
return | Cake\Console\ConsoleOptionParser |
public in ( string $prompt, string | array | null $options = null, string | null $default = null ) : mixed | ||
$prompt | string | Prompt text. |
$options | string | array | null | Array or string of options. |
$default | string | null | Default input value. |
return | mixed | Either the default value, or the user-provided input. |
public info ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean | ||
$message | string | array | null | A string or an array of strings to output |
$newlines | integer | Number of newlines to append |
$level | integer | The message's output level, see above. |
return | integer | boolean | The number of bytes returned from writing to stdout. |
public initialize ( ) : void | ||
return | void |
public io ( |
||
$io | The ConsoleIo object to use. | |
return | The current ConsoleIo object. |
public out ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean | ||
$message | string | array | null | A string or an array of strings to output |
$newlines | integer | Number of newlines to append |
$level | integer | The message's output level, see above. |
return | integer | boolean | The number of bytes returned from writing to stdout. |
public parseDispatchArguments ( array $args ) : array | ||
$args | array | Arguments fetch from the dispatchShell() method with func_get_args() |
return | array | First value has to be an array of the command arguments. Second value has to be an array of extra parameter to pass on to the dispatcher |
public runCommand ( array $argv, boolean $autoMethod = false, array $extra = [] ) : integer | boolean | null | ||
$argv | array | Array of arguments to run the shell with. This array should be missing the shell name. |
$autoMethod | boolean | Set to true to allow any public method to be called even if it was not defined as a subcommand. This is used by ShellDispatcher to make building simple shells easy. |
$extra | array | Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is : - `requested` : if used, will prevent the Shell welcome message to be displayed |
return | integer | boolean | null |
public success ( string | array | null $message = null, integer $newlines = 1, integer $level = Shell::NORMAL ) : integer | boolean | ||
$message | string | array | null | A string or an array of strings to output |
$newlines | integer | Number of newlines to append |
$level | integer | The message's output level, see above. |
return | integer | boolean | The number of bytes returned from writing to stdout. |
public ConsoleOptionParser,Cake\Console $OptionParser | ||
return | Cake\Console\ConsoleOptionParser |
public TaskRegistry,Cake\Console $Tasks | ||
return | Cake\Console\TaskRegistry |
public array $args | ||
return | array |
public string $command | ||
return | string |
public bool $interactive | ||
return | boolean |
public array $params | ||
return | array |
public string $plugin | ||
return | string |