Skip to content

Commit

Permalink
Set console options in the same fashion for every shell/task.
Browse files Browse the repository at this point in the history
  • Loading branch information
bar committed Dec 6, 2013
1 parent 8578708 commit 5c08c77
Show file tree
Hide file tree
Showing 22 changed files with 463 additions and 419 deletions.
247 changes: 123 additions & 124 deletions lib/Cake/Console/Command/AclShell.php
Expand Up @@ -356,9 +356,9 @@ public function initdb() {
}

/**
* Get the option parser.
* Gets the option parser instance and configures it.
*
* @return void
* @return ConsoleOptionParser
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
Expand All @@ -371,142 +371,141 @@ public function getOptionParser() {

$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 <node> 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 <node> 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('create', array(
'help' => __d('cake_console', 'Create a new ACL node'),
'parser' => array(
'description' => __d('cake_console', 'Creates a new ACL object <node> 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('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 <node> beneath <parent>'),
'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 <node>.'),
'required' => true
)
)
))->addSubcommand('delete', array(
'help' => __d('cake_console', 'Deletes the ACL object with the given <node> 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('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 <node>."),
__d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.")
)
))->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 <node> beneath <parent>'),
'arguments' => array(
'type' => $type,
'node' => array(
'help' => __d('cake_console', 'The node to move'),
'required' => true,
),
'arguments' => array(
'type' => $type,
'node' => array(
'help' => __d('cake_console', 'The node to get the path of'),
'required' => true,
)
'parent' => array(
'help' => __d('cake_console', 'The new parent for <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.')
),
'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('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 <node>."),
__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('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('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('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('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('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('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('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('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('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:',
'',
' - <model>.<id> - The node will be bound to a specific record of the given model.',
'',
' - <alias> - The node will be given a string alias (or path, in the case of <parent>)',
" i.e. 'John'. When used with <parent>, this takes the form of an alias path,",
" i.e. <group>/<subgroup>/<parent>.",
'',
"To add a node at the root level, enter 'root' or '/' as the <parent> parameter."
)
))->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:',
'',
' - <model>.<id> - The node will be bound to a specific record of the given model.',
'',
' - <alias> - The node will be given a string alias (or path, in the case of <parent>)',
" i.e. 'John'. When used with <parent>, this takes the form of an alias path,",
" i.e. <group>/<subgroup>/<parent>.",
'',
"To add a node at the root level, enter 'root' or '/' as the <parent> parameter."
));

return $parser;
}

Expand Down
10 changes: 7 additions & 3 deletions lib/Cake/Console/Command/ApiShell.php
Expand Up @@ -137,20 +137,24 @@ public function main() {
}

/**
* 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;
}

Expand Down
17 changes: 10 additions & 7 deletions lib/Cake/Console/Command/BakeShell.php
Expand Up @@ -203,18 +203,19 @@ public function all() {
}

/**
* 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 <name> 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 <name> 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()
Expand Down Expand Up @@ -247,6 +248,8 @@ public function getOptionParser() {
'short' => 't',
'help' => __d('cake_console', 'Theme to use when baking code.')
));

return $parser;
}

}
25 changes: 14 additions & 11 deletions lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -120,21 +120,24 @@ protected function _asXml($shellList) {
}

/**
* 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;
}

}

0 comments on commit 5c08c77

Please sign in to comment.