From 50139b153cc99d7bb076072b544ac4235cdccdd2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 12 Oct 2010 22:36:51 -0400 Subject: [PATCH] Adding OptionParser to view task. Adding epilog information about interactive mode to view and fixture tasks. --- cake/console/libs/tasks/fixture.php | 2 +- cake/console/libs/tasks/test.php | 2 +- cake/console/libs/tasks/view.php | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cake/console/libs/tasks/fixture.php b/cake/console/libs/tasks/fixture.php index 8d5a5644c66..19fe0d76f61 100644 --- a/cake/console/libs/tasks/fixture.php +++ b/cake/console/libs/tasks/fixture.php @@ -85,7 +85,7 @@ public function getOptionParser() { 'help' => 'Used with --count and /all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10', 'short' => 'r', 'boolean' => true - )); + ))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));; } /** diff --git a/cake/console/libs/tasks/test.php b/cake/console/libs/tasks/test.php index 5e1d353bbbc..52d8cf9f109 100644 --- a/cake/console/libs/tasks/test.php +++ b/cake/console/libs/tasks/test.php @@ -426,6 +426,6 @@ public function getOptionParser() { ))->addOption('plugin', array( 'short' => 'p', 'help' => __('CamelCased name of the plugin to bake tests for.') - )); + ))->epilog(__('Omitting all arguments and options will enter into an interactive mode.')); } } diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index f4f4e95bd29..8ae7dd51a9f 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -460,6 +460,33 @@ public function help() { $this->_stop(); } +/** + * get the option parser for this task + * + * @return ConsoleOptionParser + */ + public function getOptionParser() { + $parser = parent::getOptionParser(); + return $parser->description( + __('Bake views for a controller, using built-in or custom templates.') + )->addArgument('controller', array( + 'help' => __('Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.') + ))->addArgument('action', array( + 'help' => __("Will bake a single action's file. core templates are (index, add, edit, view)") + ))->addArgument('alias', array( + 'help' => __('Will bake the template in but create the filename after .') + ))->addOption('plugin', array( + 'help' => __('Plugin to bake the view into.') + ))->addOption('admin', array( + 'help' => __('Set to only bake views for a prefix in Routing.prefixes'), + 'boolean' => true + ))->addOption('connection', array( + 'help' => __('The connection the connected model is on.') + ))->addSubcommand('all', array( + 'help' => __('Bake all CRUD action views for all controllers. Requires models and controllers to exist.') + ))->epilog(__('Omitting all arguments and options will enter into an interactive mode.')); + } + /** * Returns associations for controllers models. *