HelpController
- Type
- Class
- Namespace
- craft\console\controllers
- Inherits
- craft\console\controllers\HelpController » yii\console\controllers\HelpController (opens new window) » yii\console\Controller (opens new window) » yii\base\Controller (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
- Implements
- yii\base\Configurable (opens new window), yii\base\ViewContextInterface (opens new window)
- Since
- 3.7.56
Provides help information about console commands.
This command displays the available command list in the application or the detailed instructions about using a specific command.
This command can be used as follows on command line:
yii help [command name]
In the above, if the command name is not provided, all available commands will be displayed.
View source (opens new window)
# Public Properties
# asJson
- Type
- boolean (opens new window)
- Default value
false
Should the commands help be returned in JSON format?
View source (opens new window)
# Public Methods
Method | Description |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__clone() (opens new window) | This method is called after the object is created by cloning an existing one. |
__construct() (opens new window) | |
__get() (opens new window) | Returns the value of a component property. |
__isset() (opens new window) | Checks if a property is set, i.e. defined and not null. |
__set() (opens new window) | Sets the value of a component property. |
__unset() (opens new window) | Sets a component property to be null. |
actionIndex() | Displays available commands or the detailed information about a particular command. |
actionList() (opens new window) | List all available controllers and actions in machine readable format. |
actionListActionOptions() (opens new window) | List all available options for the $action in machine readable format. |
actionUsage() (opens new window) | Displays usage information for $action. |
actions() (opens new window) | Declares external actions for the controller. |
afterAction() (opens new window) | This method is invoked right after an action is executed. |
ansiFormat() (opens new window) | Formats a string with ANSI codes. |
attachBehavior() (opens new window) | Attaches a behavior to this component. |
attachBehaviors() (opens new window) | Attaches a list of behaviors to the component. |
beforeAction() (opens new window) | This method is invoked right before an action is executed. |
behaviors() (opens new window) | Returns a list of behaviors that this component should behave as. |
bindActionParams() (opens new window) | Binds the parameters to the action. |
canGetProperty() (opens new window) | Returns a value indicating whether a property can be read. |
canSetProperty() (opens new window) | Returns a value indicating whether a property can be set. |
className() (opens new window) | Returns the fully qualified name of this class. |
confirm() (opens new window) | Asks user to confirm by typing y or n. |
createAction() (opens new window) | Creates an action based on the given action ID. |
detachBehavior() (opens new window) | Detaches a behavior from the component. |
detachBehaviors() (opens new window) | Detaches all behaviors from the component. |
ensureBehaviors() (opens new window) | Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component. |
findLayoutFile() (opens new window) | Finds the applicable layout file. |
getActionArgsHelp() (opens new window) | Returns the help information for the anonymous arguments for the action. |
getActionHelp() (opens new window) | Returns the detailed help information for the specified action. |
getActionHelpSummary() (opens new window) | Returns a one-line short summary describing the specified action. |
getActionOptionsHelp() (opens new window) | Returns the help information for the options for the action. |
getActions() (opens new window) | Returns all available actions of the specified controller. |
getBehavior() (opens new window) | Returns the named behavior object. |
getBehaviors() (opens new window) | Returns all behaviors attached to this component. |
getCommands() (opens new window) | Returns all available command names. |
getHelp() (opens new window) | Returns help information for this controller. |
getHelpSummary() (opens new window) | Returns one-line short summary describing this controller. |
getModules() (opens new window) | Returns all ancestor modules of this controller. |
getOptionValues() (opens new window) | Returns properties corresponding to the options for the action id Child classes may override this method to specify possible properties. |
getPassedOptionValues() (opens new window) | Returns the properties corresponding to the passed options. |
getPassedOptions() (opens new window) | Returns the names of valid options passed during execution. |
getRoute() (opens new window) | Returns the route of the current request. |
getUniqueId() (opens new window) | Returns the unique ID of the controller. |
getView() (opens new window) | Returns the view object that can be used to render views or view files. |
getViewPath() (opens new window) | Returns the directory containing view files for this controller. |
hasEventHandlers() (opens new window) | Returns a value indicating whether there is any handler attached to the named event. |
hasMethod() (opens new window) | Returns a value indicating whether a method is defined. |
hasProperty() (opens new window) | Returns a value indicating whether a property is defined for this component. |
init() (opens new window) | Initializes the object. |
isColorEnabled() (opens new window) | Returns a value indicating whether ANSI color is enabled. |
off() (opens new window) | Detaches an existing event handler from this component. |
on() (opens new window) | Attaches an event handler to an event. |
optionAliases() | Returns option alias names. |
options() | Returns the names of valid options for the action (id) An option requires the existence of a public member variable whose name is the option name. |
prompt() (opens new window) | Prompts the user for input and validates it. |
render() (opens new window) | Renders a view and applies layout if available. |
renderContent() (opens new window) | Renders a static string by applying a layout. |
renderFile() (opens new window) | Renders a view file. |
renderPartial() (opens new window) | Renders a view without applying layout. |
run() (opens new window) | Runs a request specified in terms of a route. |
runAction() (opens new window) | Runs an action with the specified action ID and parameters. |
select() (opens new window) | Gives the user an option to choose from. Giving '?' as an input will show a list of options to choose from and their explanations. |
setView() (opens new window) | Sets the view object to be used by this controller. |
setViewPath() (opens new window) | Sets the directory that contains the view files. |
stderr() (opens new window) | Prints a string to STDERR. |
stdout() (opens new window) | Prints a string to STDOUT. |
trigger() (opens new window) | Triggers an event. |
# actionIndex()
Displays available commands or the detailed information about a particular command.
View source (opens new window)
Arguments
$command
(string (opens new window)) – The name of the command to show help about. If not provided, all available commands will be displayed.
Returns
integer (opens new window) – The exit status
Throws
- yii\console\Exception (opens new window)
if the command for help is unknown
# optionAliases()
Returns option alias names.
Child classes may override this method to specify alias options.
View source (opens new window)
Returns
array (opens new window) – The options alias names valid for the action where the keys is alias name for option and value is option name.
# options()
Returns the names of valid options for the action (id) An option requires the existence of a public member variable whose name is the option name.
Child classes may override this method to specify possible options.
Note that the values setting via options are not available until beforeAction() (opens new window) is being called.
View source (opens new window)
Arguments
$actionID
(string (opens new window)) – The action id of the current request
Returns
string (opens new window)[] – The names of the options valid for the action
# Protected Methods
Method | Description |
---|---|
allCommandsInfo() | Return an array of information for every CLI command |
bindInjectedParams() (opens new window) | Fills parameters based on types and names in action method signature. |
commandInfo() | Return an array of information on the passed in CLI $command |
commentCleanup() | Cleans up a comment. |
formatOptionAliases() (opens new window) | |
formatOptionHelp() (opens new window) | Generates a well-formed string for an argument or option. |
getActionMethodReflection() (opens new window) | |
getCommandDescriptions() (opens new window) | Returns an array of commands an their descriptions. |
getCommandHelp() (opens new window) | Displays the overall information of the command. |
getDefaultHelp() (opens new window) | Displays all available commands. |
getDefaultHelpHeader() (opens new window) | Return a default help header. |
getModuleCommands() (opens new window) | Returns available commands of a specified module. |
getScriptName() (opens new window) | |
getSubCommandHelp() (opens new window) | Displays the detailed information of a command action. |
parseDocCommentDetail() (opens new window) | Returns full description from the docblock. |
parseDocCommentSummary() (opens new window) | Returns the first line of docblock. |
parseDocCommentTags() (opens new window) | Parses the comment block into tags. |
unformattedActionHelp() | Returns full description from the docblock without any kind of ANSI terminal formatting |
validateControllerClass() (opens new window) | Validates if the given class is a valid console controller class. |
# allCommandsInfo()
Return an array of information for every CLI command
View source (opens new window)
Returns
Throws
# commandInfo()
Return an array of information on the passed in CLI $command
View source (opens new window)
Arguments
$command
(string (opens new window))
Returns
Throws
# commentCleanup()
Cleans up a comment.
View source (opens new window)
Arguments
$comment
(string (opens new window))
Returns
# unformattedActionHelp()
Returns full description from the docblock without any kind of ANSI terminal formatting
See also yii\console\Controller::getActionHelp() (opens new window) View source (opens new window)
Arguments
$reflection
(ReflectionFunctionAbstract (opens new window))
Returns
# Constants
Constant | Description |
---|---|
EXIT_CODE_ERROR | |
EXIT_CODE_NORMAL |