* @link http://www.yiiframework.com/ * @copyright 2008-2013 Yii Software LLC * @license http://www.yiiframework.com/license/ */ /** * HelpCommand displays help information for commands under yiic shell. * * @property string $help The command description. * * @author Qiang Xue * @package system.cli.commands.shell * @since 1.0 */ class HelpCommand extends CConsoleCommand { /** * Execute the action. * @param array $args command line parameters specific for this command * @return integer non zero application exit code for help */ public function run($args) { $runner=$this->getCommandRunner(); $commands=$runner->commands; if(isset($args[0])) $name=strtolower($args[0]); if(!isset($args[0]) || !isset($commands[$name])) { echo <<' for details about a command. To expand the above command list, place your command class files under 'protected/commands/shell', or a directory specified by the 'YIIC_SHELL_COMMAND_PATH' environment variable. The command class must extend from CConsoleCommand. EOD; } else echo $runner->createCommand($name)->getHelp(); return 1; } /** * Provides the command description. * @return string the command description. */ public function getHelp() { return <<