From 5c08c77b936fa454ee182c855f60bdd1db7819d3 Mon Sep 17 00:00:00 2001 From: Ber Clausen Date: Thu, 5 Dec 2013 20:38:32 -0300 Subject: [PATCH] Set console options in the same fashion for every shell/task. --- lib/Cake/Console/Command/AclShell.php | 251 +++++++++--------- lib/Cake/Console/Command/ApiShell.php | 10 +- lib/Cake/Console/Command/BakeShell.php | 17 +- lib/Cake/Console/Command/CommandListShell.php | 25 +- lib/Cake/Console/Command/CompletionShell.php | 64 ++--- lib/Cake/Console/Command/ConsoleShell.php | 19 +- lib/Cake/Console/Command/I18nShell.php | 19 +- lib/Cake/Console/Command/SchemaShell.php | 12 +- lib/Cake/Console/Command/ServerShell.php | 26 +- .../Console/Command/Task/ControllerTask.php | 59 ++-- .../Console/Command/Task/DbConfigTask.php | 11 +- lib/Cake/Console/Command/Task/ExtractTask.php | 87 +++--- lib/Cake/Console/Command/Task/FixtureTask.php | 18 +- lib/Cake/Console/Command/Task/ModelTask.php | 47 ++-- lib/Cake/Console/Command/Task/PluginTask.php | 15 +- lib/Cake/Console/Command/Task/ProjectTask.php | 34 +-- lib/Cake/Console/Command/Task/TestTask.php | 54 ++-- lib/Cake/Console/Command/Task/ViewTask.php | 11 +- lib/Cake/Console/Command/TestShell.php | 19 +- lib/Cake/Console/Command/TestsuiteShell.php | 7 +- lib/Cake/Console/Command/UpgradeShell.php | 90 +++---- lib/Cake/Console/Shell.php | 1 + 22 files changed, 470 insertions(+), 426 deletions(-) diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index 72976b6b5..1375cd73d 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -356,9 +356,9 @@ class AclShell extends AppShell { } /** - * Get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); @@ -371,142 +371,141 @@ class AclShell extends AppShell { $parser->description( __d('cake_console', 'A console tool for managing the DbAcl') - )->addSubcommand('create', array( - 'help' => __d('cake_console', 'Create a new ACL node'), - 'parser' => array( - 'description' => __d('cake_console', 'Creates a new ACL object under the parent'), - 'epilog' => __d('cake_console', 'You can use `root` as the parent when creating nodes to create top level nodes.'), - 'arguments' => array( - 'type' => $type, - 'parent' => array( - 'help' => __d('cake_console', 'The node selector for the parent.'), - 'required' => true - ), - 'alias' => array( - 'help' => __d('cake_console', 'The alias to use for the newly created node.'), - 'required' => true - ) - ) - ) - ))->addSubcommand('delete', array( - 'help' => __d('cake_console', 'Deletes the ACL object with the given reference'), - 'parser' => array( - 'description' => __d('cake_console', 'Delete an ACL node.'), - 'arguments' => array( - 'type' => $type, - 'node' => array( - 'help' => __d('cake_console', 'The node identifier to delete.'), - 'required' => true, - ) - ) - ) - ))->addSubcommand('setparent', array( - 'help' => __d('cake_console', 'Moves the ACL node under a new parent.'), - 'parser' => array( - 'description' => __d('cake_console', 'Moves the ACL object specified by beneath '), - 'arguments' => array( - 'type' => $type, - 'node' => array( - 'help' => __d('cake_console', 'The node to move'), - 'required' => true, - ), - 'parent' => array( - 'help' => __d('cake_console', 'The new parent for .'), - 'required' => true - ) - ) - ) - ))->addSubcommand('getpath', array( - 'help' => __d('cake_console', 'Print out the path to an ACL node.'), - 'parser' => array( - 'description' => array( - __d('cake_console', "Returns the path to the ACL object specified by ."), - __d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.") + )->addSubcommand('create', array( + 'help' => __d('cake_console', 'Create a new ACL node'), + 'parser' => array( + 'description' => __d('cake_console', 'Creates a new ACL object under the parent'), + 'epilog' => __d('cake_console', 'You can use `root` as the parent when creating nodes to create top level nodes.'), + 'arguments' => array( + 'type' => $type, + 'parent' => array( + 'help' => __d('cake_console', 'The node selector for the parent.'), + 'required' => true ), - 'arguments' => array( - 'type' => $type, - 'node' => array( - 'help' => __d('cake_console', 'The node to get the path of'), - 'required' => true, - ) + 'alias' => array( + 'help' => __d('cake_console', 'The alias to use for the newly created node.'), + 'required' => true ) ) - ))->addSubcommand('check', array( - 'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'), - 'parser' => array( - 'description' => array( - __d('cake_console', 'Use this command to check ACL permissions.') + ) + ))->addSubcommand('delete', array( + 'help' => __d('cake_console', 'Deletes the ACL object with the given reference'), + 'parser' => array( + 'description' => __d('cake_console', 'Delete an ACL node.'), + 'arguments' => array( + 'type' => $type, + 'node' => array( + 'help' => __d('cake_console', 'The node identifier to delete.'), + 'required' => true, + ) + ) + ) + ))->addSubcommand('setparent', array( + 'help' => __d('cake_console', 'Moves the ACL node under a new parent.'), + 'parser' => array( + 'description' => __d('cake_console', 'Moves the ACL object specified by beneath '), + 'arguments' => array( + 'type' => $type, + 'node' => array( + 'help' => __d('cake_console', 'The node to move'), + 'required' => true, ), - 'arguments' => array( - 'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true), - 'aco' => array('help' => __d('cake_console', 'ACO to check.'), 'required' => true), - 'action' => array('help' => __d('cake_console', 'Action to check'), 'default' => 'all') + 'parent' => array( + 'help' => __d('cake_console', 'The new parent for .'), + 'required' => true ) ) - ))->addSubcommand('grant', array( - 'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'), - 'parser' => array( - 'description' => array( - __d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).') - ), - 'arguments' => array( - 'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true), - 'aco' => array('help' => __d('cake_console', 'ACO to grant access to.'), 'required' => true), - 'action' => array('help' => __d('cake_console', 'Action to grant'), 'default' => 'all') + ) + ))->addSubcommand('getpath', array( + 'help' => __d('cake_console', 'Print out the path to an ACL node.'), + 'parser' => array( + 'description' => array( + __d('cake_console', "Returns the path to the ACL object specified by ."), + __d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.") + ), + 'arguments' => array( + 'type' => $type, + 'node' => array( + 'help' => __d('cake_console', 'The node to get the path of'), + 'required' => true, ) ) - ))->addSubcommand('deny', array( - 'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'), - 'parser' => array( - 'description' => array( - __d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).') - ), - 'arguments' => array( - 'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true), - 'aco' => array('help' => __d('cake_console', 'ACO to deny.'), 'required' => true), - 'action' => array('help' => __d('cake_console', 'Action to deny'), 'default' => 'all') - ) + ) + ))->addSubcommand('check', array( + 'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'), + 'parser' => array( + 'description' => array( + __d('cake_console', 'Use this command to check ACL permissions.') + ), + 'arguments' => array( + 'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true), + 'aco' => array('help' => __d('cake_console', 'ACO to check.'), 'required' => true), + 'action' => array('help' => __d('cake_console', 'Action to check'), 'default' => 'all') ) - ))->addSubcommand('inherit', array( - 'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'), - 'parser' => array( - 'description' => array( - __d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.") - ), - 'arguments' => array( - 'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true), - 'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true), - 'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all') - ) + ) + ))->addSubcommand('grant', array( + 'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'), + 'parser' => array( + 'description' => array( + __d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).') + ), + 'arguments' => array( + 'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true), + 'aco' => array('help' => __d('cake_console', 'ACO to grant access to.'), 'required' => true), + 'action' => array('help' => __d('cake_console', 'Action to grant'), 'default' => 'all') ) - ))->addSubcommand('view', array( - 'help' => __d('cake_console', 'View a tree or a single node\'s subtree.'), - 'parser' => array( - 'description' => array( - __d('cake_console', "The view command will return the ARO or ACO tree."), - __d('cake_console', "The optional node parameter allows you to return"), - __d('cake_console', "only a portion of the requested tree.") - ), - 'arguments' => array( - 'type' => $type, - 'node' => array('help' => __d('cake_console', 'The optional node to view the subtree of.')) - ) + ) + ))->addSubcommand('deny', array( + 'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'), + 'parser' => array( + 'description' => array( + __d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).') + ), + 'arguments' => array( + 'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true), + 'aco' => array('help' => __d('cake_console', 'ACO to deny.'), 'required' => true), + 'action' => array('help' => __d('cake_console', 'Action to deny'), 'default' => 'all') ) - ))->addSubcommand('initdb', array( - 'help' => __d('cake_console', 'Initialize the DbAcl tables. Uses this command : cake schema create DbAcl') - ))->epilog( - array( - 'Node and parent arguments can be in one of the following formats:', - '', - ' - . - The node will be bound to a specific record of the given model.', - '', - ' - - The node will be given a string alias (or path, in the case of )', - " i.e. 'John'. When used with , this takes the form of an alias path,", - " i.e. //.", - '', - "To add a node at the root level, enter 'root' or '/' as the parameter." + ) + ))->addSubcommand('inherit', array( + 'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'), + 'parser' => array( + 'description' => array( + __d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.") + ), + 'arguments' => array( + 'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true), + 'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true), + 'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all') ) - ); + ) + ))->addSubcommand('view', array( + 'help' => __d('cake_console', 'View a tree or a single node\'s subtree.'), + 'parser' => array( + 'description' => array( + __d('cake_console', "The view command will return the ARO or ACO tree."), + __d('cake_console', "The optional node parameter allows you to return"), + __d('cake_console', "only a portion of the requested tree.") + ), + 'arguments' => array( + 'type' => $type, + 'node' => array('help' => __d('cake_console', 'The optional node to view the subtree of.')) + ) + ) + ))->addSubcommand('initdb', array( + 'help' => __d('cake_console', 'Initialize the DbAcl tables. Uses this command : cake schema create DbAcl') + ))->epilog(array( + 'Node and parent arguments can be in one of the following formats:', + '', + ' - . - The node will be bound to a specific record of the given model.', + '', + ' - - The node will be given a string alias (or path, in the case of )', + " i.e. 'John'. When used with , this takes the form of an alias path,", + " i.e. //.", + '', + "To add a node at the root level, enter 'root' or '/' as the parameter." + )); + return $parser; } diff --git a/lib/Cake/Console/Command/ApiShell.php b/lib/Cake/Console/Command/ApiShell.php index f3259e42e..8b0c979d7 100644 --- a/lib/Cake/Console/Command/ApiShell.php +++ b/lib/Cake/Console/Command/ApiShell.php @@ -137,20 +137,24 @@ class ApiShell extends AppShell { } /** - * Get and configure the optionparser. + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - $parser->addArgument('type', array( + + $parser->description( + __d('cake_console', 'Lookup doc block comments for classes in CakePHP.') + )->addArgument('type', array( 'help' => __d('cake_console', 'Either a full path or type of class (model, behavior, controller, component, view, helper)') ))->addArgument('className', array( 'help' => __d('cake_console', 'A CakePHP core class name (e.g: Component, HtmlHelper).') ))->addOption('method', array( 'short' => 'm', 'help' => __d('cake_console', 'The specific method you want help on.') - ))->description(__d('cake_console', 'Lookup doc block comments for classes in CakePHP.')); + )); + return $parser; } diff --git a/lib/Cake/Console/Command/BakeShell.php b/lib/Cake/Console/Command/BakeShell.php index 61f20c335..c1e59c690 100644 --- a/lib/Cake/Console/Command/BakeShell.php +++ b/lib/Cake/Console/Command/BakeShell.php @@ -203,18 +203,19 @@ class BakeShell extends AppShell { } /** - * get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description(__d('cake_console', - 'The Bake script generates controllers, views and models for your application.' . + + $parser->description( + __d('cake_console', 'The Bake script generates controllers, views and models for your application.' . ' If run with no command line arguments, Bake guides the user through the class creation process.' . - ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.' - ))->addSubcommand('all', array( - 'help' => __d('cake_console', 'Bake a complete MVC. optional of a Model'), + ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.') + )->addSubcommand('all', array( + 'help' => __d('cake_console', 'Bake a complete MVC. optional of a Model') ))->addSubcommand('project', array( 'help' => __d('cake_console', 'Bake a new app folder in the path supplied or in current directory if no path is specified'), 'parser' => $this->Project->getOptionParser() @@ -247,6 +248,8 @@ class BakeShell extends AppShell { 'short' => 't', 'help' => __d('cake_console', 'Theme to use when baking code.') )); + + return $parser; } } diff --git a/lib/Cake/Console/Command/CommandListShell.php b/lib/Cake/Console/Command/CommandListShell.php index 40cc8fc28..755166f41 100644 --- a/lib/Cake/Console/Command/CommandListShell.php +++ b/lib/Cake/Console/Command/CommandListShell.php @@ -120,21 +120,24 @@ class CommandListShell extends AppShell { } /** - * get the option parser + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description(__d('cake_console', 'Get the list of available shells for this CakePHP application.')) - ->addOption('sort', array( - 'help' => __d('cake_console', 'Does nothing (deprecated)'), - 'boolean' => true - )) - ->addOption('xml', array( - 'help' => __d('cake_console', 'Get the listing as XML.'), - 'boolean' => true - )); + + $parser->description( + __d('cake_console', 'Get the list of available shells for this CakePHP application.') + )->addOption('sort', array( + 'help' => __d('cake_console', 'Does nothing (deprecated)'), + 'boolean' => true + ))->addOption('xml', array( + 'help' => __d('cake_console', 'Get the listing as XML.'), + 'boolean' => true + )); + + return $parser; } } diff --git a/lib/Cake/Console/Command/CompletionShell.php b/lib/Cake/Console/Command/CompletionShell.php index 94e809efa..b57c84145 100644 --- a/lib/Cake/Console/Command/CompletionShell.php +++ b/lib/Cake/Console/Command/CompletionShell.php @@ -96,48 +96,48 @@ class CompletionShell extends AppShell { } /** - * getOptionParser for _this_ shell + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - $parser->description(__d('cake_console', 'Used by shells like bash to autocomplete command name, options and arguments')) - ->addSubcommand('commands', array( - 'help' => __d('cake_console', 'Output a list of available commands'), - 'parser' => array( - 'description' => __d('cake_console', 'List all availables'), - 'arguments' => array( + $parser->description( + __d('cake_console', 'Used by shells like bash to autocomplete command name, options and arguments') + )->addSubcommand('commands', array( + 'help' => __d('cake_console', 'Output a list of available commands'), + 'parser' => array( + 'description' => __d('cake_console', 'List all availables'), + 'arguments' => array( + ) + ) + ))->addSubcommand('subcommands', array( + 'help' => __d('cake_console', 'Output a list of available subcommands'), + 'parser' => array( + 'description' => __d('cake_console', 'List subcommands for a command'), + 'arguments' => array( + 'command' => array( + 'help' => __d('cake_console', 'The command name'), + 'required' => true, ) ) - ))->addSubcommand('subcommands', array( - 'help' => __d('cake_console', 'Output a list of available subcommands'), - 'parser' => array( - 'description' => __d('cake_console', 'List subcommands for a command'), - 'arguments' => array( - 'command' => array( - 'help' => __d('cake_console', 'The command name'), - 'required' => true, - ) + ) + ))->addSubcommand('options', array( + 'help' => __d('cake_console', 'Output a list of available options'), + 'parser' => array( + 'description' => __d('cake_console', 'List options'), + 'arguments' => array( + 'command' => array( + 'help' => __d('cake_console', 'The command name'), + 'required' => false, ) ) - ))->addSubcommand('options', array( - 'help' => __d('cake_console', 'Output a list of available options'), - 'parser' => array( - 'description' => __d('cake_console', 'List options'), - 'arguments' => array( - 'command' => array( - 'help' => __d('cake_console', 'The command name'), - 'required' => false, - ) - ) - ) - ))->epilog( - array( - __d('cake_console', 'This command is not intended to be called manually'), - ) - ); + ) + ))->epilog( + __d('cake_console', 'This command is not intended to be called manually') + ); + return $parser; } diff --git a/lib/Cake/Console/Command/ConsoleShell.php b/lib/Cake/Console/Command/ConsoleShell.php index 2c6d1381e..f5db3e46f 100644 --- a/lib/Cake/Console/Command/ConsoleShell.php +++ b/lib/Cake/Console/Command/ConsoleShell.php @@ -105,19 +105,19 @@ class ConsoleShell extends AppShell { } /** - * getOptionParser + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { - $description = array( + $parser = parent::getOptionParser(); + + $parser->description(array( 'The interactive console is a tool for testing parts of your', 'app before you write code.', '', 'See below for a list of supported commands.' - ); - - $epilog = array( + ))->epilog(array( 'Model testing', '', 'To test model results, use the name of your model without a leading $', @@ -176,10 +176,9 @@ class ConsoleShell extends AppShell { 'To show all connected routes, do the following:', '', "\tRoutes show", - ); - return parent::getOptionParser() - ->description($description) - ->epilog($epilog); + )); + + return $parser; } /** * Prints the help message diff --git a/lib/Cake/Console/Command/I18nShell.php b/lib/Cake/Console/Command/I18nShell.php index cad3d1ebf..c87ce6993 100644 --- a/lib/Cake/Console/Command/I18nShell.php +++ b/lib/Cake/Console/Command/I18nShell.php @@ -100,20 +100,23 @@ class I18nShell extends AppShell { } /** - * Get and configure the Option parser + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( + + $parser->description( __d('cake_console', 'I18n Shell initializes i18n database table for your application and generates .pot files(s) with translations.') - )->addSubcommand('initdb', array( - 'help' => __d('cake_console', 'Initialize the i18n table.') - ))->addSubcommand('extract', array( - 'help' => __d('cake_console', 'Extract the po translations from your application'), - 'parser' => $this->Extract->getOptionParser() - )); + )->addSubcommand('initdb', array( + 'help' => __d('cake_console', 'Initialize the i18n table.') + ))->addSubcommand('extract', array( + 'help' => __d('cake_console', 'Extract the po translations from your application'), + 'parser' => $this->Extract->getOptionParser() + )); + + return $parser; } } diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index 1d5b8ce24..92dd9aeee 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -457,11 +457,13 @@ class SchemaShell extends AppShell { } /** - * get the option parser + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { + $parser = parent::getOptionParser(); + $plugin = array( 'short' => 'p', 'help' => __d('cake_console', 'The plugin to use.'), @@ -515,11 +517,8 @@ class SchemaShell extends AppShell { 'boolean' => true ); - $parser = parent::getOptionParser(); $parser->description( - __d('cake_console', - 'The Schema Shell generates a schema object from the database and updates the database from the schema.' - ) + __d('cake_console', 'The Schema Shell generates a schema object from the database and updates the database from the schema.') )->addSubcommand('view', array( 'help' => __d('cake_console', 'Read and output the contents of a schema file'), 'parser' => array( @@ -567,6 +566,7 @@ class SchemaShell extends AppShell { ) ) )); + return $parser; } diff --git a/lib/Cake/Console/Command/ServerShell.php b/lib/Cake/Console/Command/ServerShell.php index 58f35fe85..715cd3de5 100644 --- a/lib/Cake/Console/Command/ServerShell.php +++ b/lib/Cake/Console/Command/ServerShell.php @@ -137,29 +137,25 @@ class ServerShell extends AppShell { } /** - * Get and configure the optionparser. + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - $parser->addOption('host', array( - 'short' => 'H', - 'help' => __d('cake_console', 'ServerHost') - )); - $parser->addOption('port', array( - 'short' => 'p', - 'help' => __d('cake_console', 'ListenPort') - )); - $parser->addOption('document_root', array( - 'short' => 'd', - 'help' => __d('cake_console', 'DocumentRoot') - )); - $parser->description(array( __d('cake_console', 'PHP Built-in Server for CakePHP'), - __d('cake_console', '[WARN] Don\'t use this at the production environment'), + __d('cake_console', '[WARN] Don\'t use this at the production environment') + ))->addOption('host', array( + 'short' => 'H', + 'help' => __d('cake_console', 'ServerHost') + ))->addOption('port', array( + 'short' => 'p', + 'help' => __d('cake_console', 'ListenPort') + ))->addOption('document_root', array( + 'short' => 'd', + 'help' => __d('cake_console', 'DocumentRoot') )); return $parser; diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index e788e3b7f..a306bd51f 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -456,37 +456,42 @@ class ControllerTask extends BakeTask { } /** - * get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( - __d('cake_console', 'Bake a controller for a model. Using options you can bake public, admin or both.') - )->addArgument('name', array( - 'help' => __d('cake_console', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.') - ))->addOption('public', array( - 'help' => __d('cake_console', 'Bake a controller with basic crud actions (index, view, add, edit, delete).'), - 'boolean' => true - ))->addOption('admin', array( - 'help' => __d('cake_console', 'Bake a controller with crud actions for one of the Routing.prefixes.'), - 'boolean' => true - ))->addOption('plugin', array( - 'short' => 'p', - 'help' => __d('cake_console', 'Plugin to bake the controller into.') - ))->addOption('connection', array( - 'short' => 'c', - 'help' => __d('cake_console', 'The connection the controller\'s model is on.') - ))->addOption('theme', array( - 'short' => 't', - 'help' => __d('cake_console', 'Theme to use when baking code.') - ))->addOption('force', array( - 'short' => 'f', - 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') - ))->addSubcommand('all', array( - 'help' => __d('cake_console', 'Bake all controllers with CRUD methods.') - ))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); + + $parser->description( + __d('cake_console', 'Bake a controller for a model. Using options you can bake public, admin or both.' + ))->addArgument('name', array( + 'help' => __d('cake_console', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.') + ))->addOption('public', array( + 'help' => __d('cake_console', 'Bake a controller with basic crud actions (index, view, add, edit, delete).'), + 'boolean' => true + ))->addOption('admin', array( + 'help' => __d('cake_console', 'Bake a controller with crud actions for one of the Routing.prefixes.'), + 'boolean' => true + ))->addOption('plugin', array( + 'short' => 'p', + 'help' => __d('cake_console', 'Plugin to bake the controller into.') + ))->addOption('connection', array( + 'short' => 'c', + 'help' => __d('cake_console', 'The connection the controller\'s model is on.') + ))->addOption('theme', array( + 'short' => 't', + 'help' => __d('cake_console', 'Theme to use when baking code.') + ))->addOption('force', array( + 'short' => 'f', + 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') + ))->addSubcommand('all', array( + 'help' => __d('cake_console', 'Bake all controllers with CRUD methods.') + ))->epilog( + __d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.') + ); + + return $parser; } } diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index 7e61b568b..9da7ed226 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -368,15 +368,18 @@ class DbConfigTask extends AppShell { } /** - * get the option parser + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( - __d('cake_console', 'Bake new database configuration settings.') - ); + + $parser->description( + __d('cake_console', 'Bake new database configuration settings.') + ); + + return $parser; } } diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 2c547ed82..3df160bd8 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -296,52 +296,55 @@ class ExtractTask extends AppShell { } /** - * Get & configure the option parser + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description(__d('cake_console', 'CakePHP Language String Extraction:')) - ->addOption('app', array('help' => __d('cake_console', 'Directory where your application is located.'))) - ->addOption('paths', array('help' => __d('cake_console', 'Comma separated list of paths.'))) - ->addOption('merge', array( - 'help' => __d('cake_console', 'Merge all domain and category strings into the default.po file.'), - 'choices' => array('yes', 'no') - )) - ->addOption('output', array('help' => __d('cake_console', 'Full path to output directory.'))) - ->addOption('files', array('help' => __d('cake_console', 'Comma separated list of files.'))) - ->addOption('exclude-plugins', array( - 'boolean' => true, - 'default' => true, - 'help' => __d('cake_console', 'Ignores all files in plugins if this command is run inside from the same app directory.') - )) - ->addOption('plugin', array( - 'help' => __d('cake_console', 'Extracts tokens only from the plugin specified and puts the result in the plugin\'s Locale directory.') - )) - ->addOption('ignore-model-validation', array( - 'boolean' => true, - 'default' => false, - 'help' => __d('cake_console', 'Ignores validation messages in the $validate property.' . - ' If this flag is not set and the command is run from the same app directory,' . - ' all messages in model validation rules will be extracted as tokens.') - )) - ->addOption('validation-domain', array( - 'help' => __d('cake_console', 'If set to a value, the localization domain to be used for model validation messages.') - )) - ->addOption('exclude', array( - 'help' => __d('cake_console', 'Comma separated list of directories to exclude.' . - ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors') - )) - ->addOption('overwrite', array( - 'boolean' => true, - 'default' => false, - 'help' => __d('cake_console', 'Always overwrite existing .pot files.') - )) - ->addOption('extract-core', array( - 'help' => __d('cake_console', 'Extract messages from the CakePHP core libs.'), - 'choices' => array('yes', 'no') - )); + + $parser->description( + __d('cake_console', 'CakePHP Language String Extraction:') + )->addOption('app', array( + 'help' => __d('cake_console', 'Directory where your application is located.') + ))->addOption('paths', array( + 'help' => __d('cake_console', 'Comma separated list of paths.') + ))->addOption('merge', array( + 'help' => __d('cake_console', 'Merge all domain and category strings into the default.po file.'), + 'choices' => array('yes', 'no') + ))->addOption('output', array( + 'help' => __d('cake_console', 'Full path to output directory.') + ))->addOption('files', array( + 'help' => __d('cake_console', 'Comma separated list of files.') + ))->addOption('exclude-plugins', array( + 'boolean' => true, + 'default' => true, + 'help' => __d('cake_console', 'Ignores all files in plugins if this command is run inside from the same app directory.') + ))->addOption('plugin', array( + 'help' => __d('cake_console', 'Extracts tokens only from the plugin specified and puts the result in the plugin\'s Locale directory.') + ))->addOption('ignore-model-validation', array( + 'boolean' => true, + 'default' => false, + 'help' => __d('cake_console', 'Ignores validation messages in the $validate property.' . + ' If this flag is not set and the command is run from the same app directory,' . + ' all messages in model validation rules will be extracted as tokens.' + ) + ))->addOption('validation-domain', array( + 'help' => __d('cake_console', 'If set to a value, the localization domain to be used for model validation messages.') + ))->addOption('exclude', array( + 'help' => __d('cake_console', 'Comma separated list of directories to exclude.' . + ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors' + ) + ))->addOption('overwrite', array( + 'boolean' => true, + 'default' => false, + 'help' => __d('cake_console', 'Always overwrite existing .pot files.') + ))->addOption('extract-core', array( + 'help' => __d('cake_console', 'Extract messages from the CakePHP core libs.'), + 'choices' => array('yes', 'no') + )); + + return $parser; } /** diff --git a/lib/Cake/Console/Command/Task/FixtureTask.php b/lib/Cake/Console/Command/Task/FixtureTask.php index 828fba73f..0be6d36dd 100644 --- a/lib/Cake/Console/Command/Task/FixtureTask.php +++ b/lib/Cake/Console/Command/Task/FixtureTask.php @@ -60,13 +60,14 @@ class FixtureTask extends BakeTask { } /** - * get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( + + $parser->description( __d('cake_console', 'Generate fixtures for use with the test suite. You can use `bake fixture all` to bake all fixtures.') )->addArgument('name', array( 'help' => __d('cake_console', 'Name of the fixture to bake. Can use Plugin.name to bake plugin fixtures.') @@ -80,7 +81,7 @@ class FixtureTask extends BakeTask { 'default' => 'default' ))->addOption('plugin', array( 'help' => __d('cake_console', 'CamelCased name of the plugin to bake fixtures for.'), - 'short' => 'p', + 'short' => 'p' ))->addOption('schema', array( 'help' => __d('cake_console', 'Importing schema for fixtures rather than hardcoding it.'), 'short' => 's', @@ -92,10 +93,15 @@ class FixtureTask extends BakeTask { 'short' => 'f', 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') ))->addOption('records', array( - 'help' => __d('cake_console', 'Used with --count and /all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10.'), + 'help' => __d('cake_console', '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(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); + ))->epilog( + __d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.') + ); + + return $parser; } /** diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php index ba7ddcb0e..e1cdfa2ae 100644 --- a/lib/Cake/Console/Command/Task/ModelTask.php +++ b/lib/Cake/Console/Command/Task/ModelTask.php @@ -999,31 +999,36 @@ class ModelTask extends BakeTask { } /** - * get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( - __d('cake_console', 'Bake models.') - )->addArgument('name', array( - 'help' => __d('cake_console', 'Name of the model to bake. Can use Plugin.name to bake plugin models.') - ))->addSubcommand('all', array( - 'help' => __d('cake_console', 'Bake all model files with associations and validation.') - ))->addOption('plugin', array( - 'short' => 'p', - 'help' => __d('cake_console', 'Plugin to bake the model into.') - ))->addOption('theme', array( - 'short' => 't', - 'help' => __d('cake_console', 'Theme to use when baking code.') - ))->addOption('connection', array( - 'short' => 'c', - 'help' => __d('cake_console', 'The connection the model table is on.') - ))->addOption('force', array( - 'short' => 'f', - 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') - ))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); + + $parser->description( + __d('cake_console', 'Bake models.') + )->addArgument('name', array( + 'help' => __d('cake_console', 'Name of the model to bake. Can use Plugin.name to bake plugin models.') + ))->addSubcommand('all', array( + 'help' => __d('cake_console', 'Bake all model files with associations and validation.') + ))->addOption('plugin', array( + 'short' => 'p', + 'help' => __d('cake_console', 'Plugin to bake the model into.') + ))->addOption('theme', array( + 'short' => 't', + 'help' => __d('cake_console', 'Theme to use when baking code.') + ))->addOption('connection', array( + 'short' => 'c', + 'help' => __d('cake_console', 'The connection the model table is on.') + ))->addOption('force', array( + 'short' => 'f', + 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') + ))->epilog( + __d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.') + ); + + return $parser; } /** diff --git a/lib/Cake/Console/Command/Task/PluginTask.php b/lib/Cake/Console/Command/Task/PluginTask.php index b5f9c2cbe..a49047d4b 100644 --- a/lib/Cake/Console/Command/Task/PluginTask.php +++ b/lib/Cake/Console/Command/Task/PluginTask.php @@ -209,18 +209,21 @@ class PluginTask extends AppShell { } /** - * get the option parser for the plugin task + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description(__d('cake_console', - 'Create the directory structure, AppModel and AppController classes for a new plugin. ' . - 'Can create plugins in any of your bootstrapped plugin paths.' - ))->addArgument('name', array( + + $parser->description( + __d('cake_console', 'Create the directory structure, AppModel and AppController classes for a new plugin. ' . + 'Can create plugins in any of your bootstrapped plugin paths.') + )->addArgument('name', array( 'help' => __d('cake_console', 'CamelCased name of the plugin to create.') )); + + return $parser; } } diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index 557f6f0af..c3225a99f 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -419,26 +419,30 @@ class ProjectTask extends AppShell { } /** - * get the option parser. + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( - __d('cake_console', 'Generate a new CakePHP project skeleton.') - )->addArgument('name', array( - 'help' => __d('cake_console', 'Application directory to make, if it starts with "/" the path is absolute.') - ))->addOption('empty', array( - 'boolean' => true, - 'help' => __d('cake_console', 'Create empty files in each of the directories. Good if you are using git') - ))->addOption('theme', array( - 'short' => 't', - 'help' => __d('cake_console', 'Theme to use when baking code.') - ))->addOption('skel', array( - 'default' => current(App::core('Console')) . 'Templates' . DS . 'skel', - 'help' => __d('cake_console', 'The directory layout to use for the new application skeleton. Defaults to cake/Console/Templates/skel of CakePHP used to create the project.') - )); + + $parser->description( + __d('cake_console', 'Generate a new CakePHP project skeleton.') + )->addArgument('name', array( + 'help' => __d('cake_console', 'Application directory to make, if it starts with "/" the path is absolute.') + ))->addOption('empty', array( + 'boolean' => true, + 'help' => __d('cake_console', 'Create empty files in each of the directories. Good if you are using git') + ))->addOption('theme', array( + 'short' => 't', + 'help' => __d('cake_console', 'Theme to use when baking code.') + ))->addOption('skel', array( + 'default' => current(App::core('Console')) . 'Templates' . DS . 'skel', + 'help' => __d('cake_console', 'The directory layout to use for the new application skeleton.' . + ' Defaults to cake/Console/Templates/skel of CakePHP used to create the project.') + )); + + return $parser; } } diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index a2f723e64..f85d57cd0 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -543,34 +543,40 @@ class TestTask extends BakeTask { } /** - * get the option parser. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description(__d('cake_console', 'Bake test case skeletons for classes.')) - ->addArgument('type', array( - 'help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'), - 'choices' => array( - 'Controller', 'controller', - 'Model', 'model', - 'Helper', 'helper', - 'Component', 'component', - 'Behavior', 'behavior' - ) - ))->addArgument('name', array( - 'help' => __d('cake_console', 'An existing class to bake tests for.') - ))->addOption('theme', array( - 'short' => 't', - 'help' => __d('cake_console', 'Theme to use when baking code.') - ))->addOption('plugin', array( - 'short' => 'p', - 'help' => __d('cake_console', 'CamelCased name of the plugin to bake tests for.') - ))->addOption('force', array( - 'short' => 'f', - 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') - ))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); + + $parser->description( + __d('cake_console', 'Bake test case skeletons for classes.') + )->addArgument('type', array( + 'help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'), + 'choices' => array( + 'Controller', 'controller', + 'Model', 'model', + 'Helper', 'helper', + 'Component', 'component', + 'Behavior', 'behavior' + ) + ))->addArgument('name', array( + 'help' => __d('cake_console', 'An existing class to bake tests for.') + ))->addOption('theme', array( + 'short' => 't', + 'help' => __d('cake_console', 'Theme to use when baking code.') + ))->addOption('plugin', array( + 'short' => 'p', + 'help' => __d('cake_console', 'CamelCased name of the plugin to bake tests for.') + ))->addOption('force', array( + 'short' => 'f', + 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') + ))->epilog( + __d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.') + ); + + return $parser; } } diff --git a/lib/Cake/Console/Command/Task/ViewTask.php b/lib/Cake/Console/Command/Task/ViewTask.php index 4a84d87d7..8fc387aba 100644 --- a/lib/Cake/Console/Command/Task/ViewTask.php +++ b/lib/Cake/Console/Command/Task/ViewTask.php @@ -412,13 +412,14 @@ class ViewTask extends BakeTask { } /** - * get the option parser for this task + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); - return $parser->description( + + $parser->description( __d('cake_console', 'Bake views for a controller, using built-in or custom templates.') )->addArgument('controller', array( 'help' => __d('cake_console', 'Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.') @@ -443,7 +444,11 @@ class ViewTask extends BakeTask { 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') ))->addSubcommand('all', array( 'help' => __d('cake_console', 'Bake all CRUD action views for all controllers. Requires models and controllers to exist.') - ))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); + ))->epilog( + __d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.') + ); + + return $parser; } /** diff --git a/lib/Cake/Console/Command/TestShell.php b/lib/Cake/Console/Command/TestShell.php index dd955d8a2..912fdac53 100644 --- a/lib/Cake/Console/Command/TestShell.php +++ b/lib/Cake/Console/Command/TestShell.php @@ -38,20 +38,21 @@ class TestShell extends Shell { protected $_dispatcher = null; /** - * get the option parser for the test suite. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = new ConsoleOptionParser($this->name); - $parser->description(array( - __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'), - ))->addArgument('category', array( + + $parser->description( + __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line') + )->addArgument('category', array( 'help' => __d('cake_console', 'The category for the test, or test file, to test.'), - 'required' => false, + 'required' => false ))->addArgument('file', array( 'help' => __d('cake_console', 'The path to the file, or test file, to test.'), - 'required' => false, + 'required' => false ))->addOption('log-junit', array( 'help' => __d('cake_console', ' Log test execution in JUnit XML format to file.'), 'default' => false @@ -153,9 +154,9 @@ class TestShell extends Shell { 'help' => __d('cake_console', 'key[=value] Sets a php.ini value.'), 'default' => false ))->addOption('fixture', array( - 'help' => __d('cake_console', 'Choose a custom fixture manager.'), + 'help' => __d('cake_console', 'Choose a custom fixture manager.') ))->addOption('debug', array( - 'help' => __d('cake_console', 'More verbose output.'), + 'help' => __d('cake_console', 'More verbose output.') )); return $parser; diff --git a/lib/Cake/Console/Command/TestsuiteShell.php b/lib/Cake/Console/Command/TestsuiteShell.php index cd63aae58..d37ac501b 100644 --- a/lib/Cake/Console/Command/TestsuiteShell.php +++ b/lib/Cake/Console/Command/TestsuiteShell.php @@ -32,15 +32,16 @@ App::uses('CakeTestLoader', 'TestSuite'); class TestsuiteShell extends TestShell { /** - * get the option parser for the test suite. + * Gets the option parser instance and configures it. * - * @return void + * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); + $parser->description(array( __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'), - __d('cake_console', "This shell is for backwards-compatibility only\nuse the test shell instead"), + __d('cake_console', "This shell is for backwards-compatibility only\nuse the test shell instead") )); return $parser; diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 0169b53a0..5d88d6bcd 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -779,11 +779,13 @@ class UpgradeShell extends AppShell { } /** - * get the option parser + * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { + $parser = parent::getOptionParser(); + $subcommandParser = array( 'options' => array( 'plugin' => array( @@ -808,53 +810,45 @@ class UpgradeShell extends AppShell { ) ); - return parent::getOptionParser() - ->description(__d('cake_console', "A shell to help automate upgrading from CakePHP 1.3 to 2.0. \n" . - "Be sure to have a backup of your application before running these commands.")) - ->addSubcommand('all', array( - 'help' => __d('cake_console', 'Run all upgrade commands.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('tests', array( - 'help' => __d('cake_console', 'Update tests class names to FooTest rather than FooTestCase.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('locations', array( - 'help' => __d('cake_console', 'Move files and folders to their new homes.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('i18n', array( - 'help' => __d('cake_console', 'Update the i18n translation method calls.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('helpers', array( - 'help' => __d('cake_console', 'Update calls to helpers.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('basics', array( - 'help' => __d('cake_console', 'Update removed basics functions to PHP native functions.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('request', array( - 'help' => __d('cake_console', 'Update removed request access, and replace with $this->request.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('configure', array( - 'help' => __d('cake_console', "Update Configure::read() to Configure::read('debug')"), - 'parser' => $subcommandParser - )) - ->addSubcommand('constants', array( - 'help' => __d('cake_console', "Replace Obsolete constants"), - 'parser' => $subcommandParser - )) - ->addSubcommand('components', array( - 'help' => __d('cake_console', 'Update components to extend Component class.'), - 'parser' => $subcommandParser - )) - ->addSubcommand('exceptions', array( - 'help' => __d('cake_console', 'Replace use of cakeError with exceptions.'), - 'parser' => $subcommandParser - )); + $parser->description( + __d('cake_console', "A shell to help automate upgrading from CakePHP 1.3 to 2.0. \n" . + "Be sure to have a backup of your application before running these commands." + ))->addSubcommand('all', array( + 'help' => __d('cake_console', 'Run all upgrade commands.'), + 'parser' => $subcommandParser + ))->addSubcommand('tests', array( + 'help' => __d('cake_console', 'Update tests class names to FooTest rather than FooTestCase.'), + 'parser' => $subcommandParser + ))->addSubcommand('locations', array( + 'help' => __d('cake_console', 'Move files and folders to their new homes.'), + 'parser' => $subcommandParser + ))->addSubcommand('i18n', array( + 'help' => __d('cake_console', 'Update the i18n translation method calls.'), + 'parser' => $subcommandParser + ))->addSubcommand('helpers', array( + 'help' => __d('cake_console', 'Update calls to helpers.'), + 'parser' => $subcommandParser + ))->addSubcommand('basics', array( + 'help' => __d('cake_console', 'Update removed basics functions to PHP native functions.'), + 'parser' => $subcommandParser + ))->addSubcommand('request', array( + 'help' => __d('cake_console', 'Update removed request access, and replace with $this->request.'), + 'parser' => $subcommandParser + ))->addSubcommand('configure', array( + 'help' => __d('cake_console', "Update Configure::read() to Configure::read('debug')"), + 'parser' => $subcommandParser + ))->addSubcommand('constants', array( + 'help' => __d('cake_console', "Replace Obsolete constants"), + 'parser' => $subcommandParser + ))->addSubcommand('components', array( + 'help' => __d('cake_console', 'Update components to extend Component class.'), + 'parser' => $subcommandParser + ))->addSubcommand('exceptions', array( + 'help' => __d('cake_console', 'Replace use of cakeError with exceptions.'), + 'parser' => $subcommandParser + )); + + return $parser; } } diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 7a6bb5af3..e595ea2c8 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -456,6 +456,7 @@ class Shell extends Object { /** * Gets the option parser instance and configures it. + * * By overriding this method you can configure the ConsoleOptionParser before returning it. * * @return ConsoleOptionParser