mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating help for bake
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5264 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ed23e08921
commit
ad98ae8a1f
5 changed files with 70 additions and 27 deletions
|
@ -268,7 +268,7 @@ class ShellDispatcher {
|
|||
$this->shellCommand = Inflector::variable($command);
|
||||
$shell = new $this->shellClass($this);
|
||||
$this->shiftArgs();
|
||||
|
||||
|
||||
if($command == 'help') {
|
||||
if(method_exists($shell, 'help')) {
|
||||
$shell->help();
|
||||
|
@ -277,18 +277,26 @@ class ShellDispatcher {
|
|||
$this->help();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$shell->initialize();
|
||||
$shell->loadTasks();
|
||||
|
||||
|
||||
foreach($shell->taskNames as $task) {
|
||||
$shell->{$task}->initialize();
|
||||
$shell->{$task}->loadTasks();
|
||||
}
|
||||
|
||||
|
||||
$task = Inflector::camelize($command);
|
||||
if(in_array($task, $shell->taskNames)) {
|
||||
$shell->{$task}->startup();
|
||||
if(isset($this->args[0]) && $this->args[0] == 'help') {
|
||||
if(method_exists($shell->{$task}, 'help')) {
|
||||
$shell->{$task}->help();
|
||||
exit();
|
||||
} else {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
$shell->{$task}->execute();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -58,15 +58,12 @@ class BakeShell extends Shell {
|
|||
$classToBake = strtoupper($this->in('What would you like to Bake?', array('M', 'V', 'C')));
|
||||
switch($classToBake) {
|
||||
case 'M':
|
||||
$invalidSelection = false;
|
||||
$this->Model->execute();
|
||||
break;
|
||||
case 'V':
|
||||
$invalidSelection = false;
|
||||
$this->View->execute();
|
||||
break;
|
||||
case 'C':
|
||||
$invalidSelection = false;
|
||||
$this->Controller->execute();
|
||||
break;
|
||||
default:
|
||||
|
@ -75,7 +72,11 @@ class BakeShell extends Shell {
|
|||
$this->hr();
|
||||
$this->main();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function help() {
|
||||
$this->out('CakePHP Bake:');
|
||||
$this->hr();
|
||||
|
@ -83,17 +84,20 @@ class BakeShell extends Shell {
|
|||
$this->out('If run with no command line arguments, Bake guides the user through the class');
|
||||
$this->out('creation process. You can customize the generation process by telling Bake');
|
||||
$this->out('where different parts of your application are using command line arguments.');
|
||||
$this->out('');
|
||||
$this->hr('');
|
||||
$this->out('usage: cake bake [command] [params...]');
|
||||
$this->out('');
|
||||
$this->out('params:');
|
||||
$this->out(' -app [path...] Absolute/Relative path to your app folder.');
|
||||
$this->out('commands:');
|
||||
$this->out(' help Shows this help message.');
|
||||
$this->out(' project [path...] Generates a new app folder in the path supplied.');
|
||||
$this->out(' db_config Generates the database configuration file.');
|
||||
$this->out('');
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake <command> <arg1> <arg2>...");
|
||||
$this->hr();
|
||||
$this->out('Params:');
|
||||
$this->out("\t-app <path> Absolute/Relative path to your app folder.\n");
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tbake help\n\t\tshows this help message.");
|
||||
$this->out("\n\tbake project <path>\n\t\tbakes a new app folder in the path supplied\n\t\tor in current directory if no path is specified");
|
||||
$this->out("\n\tbake db_config\n\t\tbakes a database.php file in config directory.");
|
||||
$this->out("\n\tbake model\n\t\tbakes a model. run 'bake model help' for more info");
|
||||
$this->out("\n\tbake view\n\t\tbakes views. run 'bake view help' for more info");
|
||||
$this->out("\n\tbake controller\n\t\tbakes a controller. run 'bake controller help' for more info");
|
||||
$this->out("");
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -555,4 +555,21 @@ class ControllerTask extends Shell {
|
|||
}
|
||||
return $admin;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake controller <arg1> <arg2>...");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tcontroller <name>\n\t\tbakes controller with var \$scaffold");
|
||||
$this->out("\n\tcontroller <name> scaffold\n\t\tbakes controller with scaffold actions.\n\t\t(index, view, add, edit, delete)");
|
||||
$this->out("\n\tcontroller <name> scaffold admin\n\t\tbakes a controller with scaffold actions for both public and CAKE_ADMIN");
|
||||
$this->out("\n\tcontroller <name> null admin\n\t\tbakes a controller with scaffold actions for CAKE_ADMIN");
|
||||
$this->out("");
|
||||
exit();
|
||||
}
|
||||
}
|
|
@ -647,5 +647,18 @@ class ModelTask extends Shell {
|
|||
|
||||
return $currentModelName;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake model");
|
||||
$this->hr();
|
||||
$this->out("this task is currently only run in interactive mode");
|
||||
$this->out("");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -79,10 +79,6 @@ class ViewTask extends Shell {
|
|||
$this->__interactive();
|
||||
}
|
||||
|
||||
if(isset($this->args[0]) == 1 && $this->args[0] == 'help') {
|
||||
$this->help();
|
||||
}
|
||||
|
||||
$controller = $action = $alias = null;
|
||||
if(isset($this->args[0])) {
|
||||
$this->controllerName = Inflector::camelize($this->args[0]);
|
||||
|
@ -334,14 +330,19 @@ class ViewTask extends Shell {
|
|||
return false;
|
||||
}
|
||||
/**
|
||||
* Builds content from template and variables
|
||||
* Displays help contents
|
||||
*
|
||||
* @param string $template file to use
|
||||
* @param array $params passed from controller
|
||||
* @return void
|
||||
*/
|
||||
function help() {
|
||||
$this->out('Help');
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake view <arg1> <arg2>...");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tview <controller>\n\t\twill read the given controller for methods\n\t\tand bake corresponding views.\n\t\tIf var scaffold is found it will bake the scaffolded actions\n\t\t(index,view,add,edit)");
|
||||
$this->out("\n\tview <controller> <action>\n\t\twill bake a template. core templates: (index, add, edit, view)");
|
||||
$this->out("\n\tview <controller> <template> <alias>\n\t\twill use the template specified but name the file based on the alias");
|
||||
$this->out("");
|
||||
exit();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue