Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Additional drush command for showing module info - branch Dev #18

Merged
merged 3 commits into from

2 participants

@sbilde

Hello Jamie.

First of all, Thanks for this great tool! - I work with the NBDrupalDevel-tool daily, and it's such a productivity-booster, and really great as im still learning the ropes of drupal.

I don't know if it has your interest, but I added a drush-command for showing module info for various reasons.. - Oh ya, and created a alias for your nb-hook (great command!).

I plan to do a bunch of snippets, for the code-folder for both 6 & 7. Let me know, if it has any interest as well.

Keep up the good work, and I look forward to the 3.0 release.

Best regards,

Steffen

@HollyIT
Owner

That sounds awesome! I'm hoping to get a bug fix in this week and I can merge your pull in.

Thanks!!

@HollyIT HollyIT merged commit fe41f53 into HollyIT:master
@HollyIT HollyIT referenced this pull request from a commit
Jamie Holly release 2.0.10 ticket #17 merge #18 b3bee54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 47 additions and 3 deletions.
  1. +47 −3 release/NBDrush/nbdevel.drush.inc
View
50 release/NBDrush/nbdevel.drush.inc
@@ -3,15 +3,29 @@
function nbdevel_drush_command() {
$items = array();
- // The 'make-me-a-sandwich' command
$items['nb-hook'] = array(
'description' => 'List implementations of a given hook and explore source of specified one.',
+ 'aliases' => array('nbh'),
'arguments' => array(
'hook' => 'The name of the hook to explore.'
),
+ 'examples' => array(
+ 'drush nbh menu_alter' => 'List modules that implements hook_menu_alter.',
+ ),
);
-
-
+ $items['nb-module'] = array(
+ 'description' => 'List info about a specific module',
+ 'aliases' => array('nbm'),
+ 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+ 'arguments' => array(
+ 'module-name' => '- The module of which you want info',
+ ),
+ 'examples' => array(
+ 'drush nbm views' => '- Show module information of Views',
+ ),
+ 'callback' => 'drush_nbdevel_moduleinfo',
+ );
+
return $items;
}
@@ -63,4 +77,34 @@ function drush_nbdevel_fn_view($function_name) {
drush_print(dt("<a href='file://!path:!startline' style='text-decoration:underline;color:#0000AA;'>!file:!startline</a>", $func_info));
//_drush_devel_print_function($reflect->getFileName(), $reflect->getStartLine(), $reflect->getEndLine());
+}
+
+
+/**
+ * Implements custom drush command for nb-module (moduleinfo).
+ */
+function drush_nbdevel_moduleinfo($alias) {
+ drush_set_option('module-name', $alias);
+ if (module_exists($alias)) {
+
+ $dependency_list = 'None';
+ $module = drush_get_option('module-name', NULL);
+ $rsc = drush_db_select('system', 'filename', 'name=:name', array(':name' => $module));
+ $filename = drush_db_result($rsc);
+ $info_file = drupal_parse_info_file(dirname($filename) . '/' . $module . '.info');
+ if (isset($info_file['dependencies'])) {
+ $dependency_list = implode("\n", $info_file['dependencies']);
+ }
+
+ drush_print_table(array(
+ array('Name: ', $info_file['name']),
+ array('Description: ', $info_file['description']),
+ array('Version: ', $info_file['version']),
+ array('Module path: ', dirname($filename)),
+ array('Dependencies: ', $dependency_list),
+ ),TRUE);
+ }
+ else {
+ drush_print("Couldn't find the ".$alias."-module");
+ }
}
Something went wrong with that request. Please try again.