Methods |
public
|
__construct(string $name)
Constructor
|
#
|
public
|
setName(string $name): object
Setter for $name
Parameters
Returns
LucidFrame\Console\Command
|
#
|
public
|
getName(): string
Getter for $name
|
#
|
public
|
setDescription(string $description = null): object
Setter for $description
Parameters
$description |
The description for the command
|
Returns
LucidFrame\Console\Command
|
#
|
public
|
getDescription(): string
Setter for $description
|
#
|
public
|
setHelp(string $help = null): object
Setter for $help
Parameters
$help |
The help tip for the command
|
Returns
LucidFrame\Console\Command`
|
#
|
public
|
getHelp(): string
Setter for $help
|
#
|
public
|
addOption(
string $name,
string $shortcut = null,
string $description = '',
mixed $default = null,
int $type = LC_CONSOLE_OPTION_OPTIONAL,
): object
Add an option for the command
Add an option for the command
Parameters
$name |
The option name without the prefix -- , i.e,. help for --help
|
$shortcut |
The short option name without the prefix - , i.e, h for -h
|
$description |
A short description for the option
|
$default |
The default value for the option
|
$type |
A constant: LC_CONSOLE_OPTION_REQUIRED, LC_CONSOLE_OPTION_OPTIONAL, LC_CONSOLE_OPTION_NOVALUE
|
Returns
LucidFrame\Console\Command
|
#
|
public
|
addArgument(string $name, string $description = '', mixed $default = null): object
Add an argument for the command
Add an argument for the command
Parameters
$name |
The argument name
|
$description |
A short description for the argument
|
$default |
The default value for the option
|
Returns
LucidFrame\Console\Command
|
#
|
public
|
getArguments()
Getter for $parsedArguments
Getter for $parsedArguments
|
#
|
public
|
getOptions()
Getter for $parsedOptions
Getter for $parsedOptions
|
#
|
public
|
setDefinition(Closure|string $function): object
Setter for $definition
Parameters
$function |
Anonymous function or class name that performs the job of the command
|
Returns
LucidFrame\Console\Command`
|
#
|
public
|
register(): object
Register a command
Returns
LucidFrame\Console\Command`
|
#
|
public
|
getOption(string $name): mixed
Get an option from the command
Get an option from the command
Parameters
$name |
The option name without the prefix -- , i.e,. help for --help
|
|
#
|
public
|
getArgument(string $name): mixed
Get an argument from the command
Get an argument from the command
Parameters
|
#
|
public
|
getParsedOptions()
Getter for $parsedOptions
Getter for $parsedOptions
|
#
|
public
|
getParsedArguments()
Getter for $parsedArguments
Getter for $parsedArguments
|
#
|
public
|
resetToDefaults()
Reset default values to arguments and options
Reset default values to arguments and options
|
#
|
public
|
run(array $argv = []): mixed
Run the command
Parameters
$argv |
Array of arguments passed to script
|
|
#
|
public
|
showHelp(): void
Display the help message
|
#
|
public
|
parseArguments(array $argv = []): array
Parse the arguments for the command
Parse the arguments for the command
Parameters
$argv |
Array of arguments passed to script
|
|
#
|
public
|
confirm(string $message = 'Are you sure? Type "yes" or "y" to continue:', string|array $input = ['yes', 'y']): boolean
Console confirmation prompt
Console confirmation prompt
Parameters
$message |
The confirmation message
|
$input |
The input to be allowed or to be checked against
|
Returns
TRUE if it is passed; otherwise FALSE
|
#
|
Properties |
protected
|
string
|
$name
The command name
|
#
|
protected
|
string
|
$description
The description for the command
The description for the command
|
#
|
protected
|
string
|
$help
The help tip for the command
The help tip for the command
|
#
|
protected
|
array
|
$options = []
The options for the command such as --help etc.
The options for the command such as --help etc.
|
#
|
protected
|
array
|
$shortcuts = []
The short options of the long options defined for the command such as -h for --help, etc.
The short options of the long options defined for the command such as -h for --help, etc.
|
#
|
protected
|
array
|
$arguments = []
The arguments for the command
The arguments for the command
|
#
|
protected
|
array
|
$argumentNames = []
Array of the argument names
Array of the argument names
|
#
|
protected
|
Closure|string
|
$definition
Anonymous function or class name that performs the job of the command
Anonymous function or class name that performs the job of the command
|
#
|