Skip to content
This repository

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

Merged
merged 3 commits into from about 2 years ago

2 participants

Steffen Bilde Jamie Holly
Steffen Bilde

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

Jamie Holly
Owner

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

Thanks!!

Jamie Holly HollyIT merged commit fe41f53 into from March 17, 2012
Jamie Holly HollyIT closed this March 17, 2012
Jamie Holly HollyIT referenced this pull request from a commit March 17, 2012
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 1 changed file with 47 additions and 3 deletions. Show diff stats Hide diff stats

  1. 50  release/NBDrush/nbdevel.drush.inc
50  release/NBDrush/nbdevel.drush.inc
@@ -3,15 +3,29 @@
3 3
 function nbdevel_drush_command() {
4 4
   $items = array();
5 5
 
6  
-  // The 'make-me-a-sandwich' command
7 6
   $items['nb-hook'] = array(
8 7
     'description' => 'List implementations of a given hook and explore source of specified one.',
  8
+    'aliases' => array('nbh'),
9 9
     'arguments' => array(
10 10
       'hook' => 'The name of the hook to explore.'
11 11
     ),
  12
+    'examples' => array(
  13
+      'drush nbh menu_alter' => 'List modules that implements hook_menu_alter.',
  14
+    ),
12 15
   );
13  
-
14  
-
  16
+  $items['nb-module'] = array(
  17
+    'description' => 'List info about a specific module',
  18
+    'aliases' => array('nbm'),
  19
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  20
+    'arguments' => array(
  21
+      'module-name' => '- The module of which you want info',
  22
+    ),
  23
+    'examples' => array(
  24
+      'drush nbm views' => '- Show module information of Views',
  25
+    ),
  26
+    'callback' => 'drush_nbdevel_moduleinfo',
  27
+  );
  28
+  
15 29
 
16 30
   return $items;
17 31
 }
@@ -63,4 +77,34 @@ function drush_nbdevel_fn_view($function_name) {
63 77
   drush_print(dt("<a href='file://!path:!startline' style='text-decoration:underline;color:#0000AA;'>!file:!startline</a>", $func_info));
64 78
 
65 79
   //_drush_devel_print_function($reflect->getFileName(), $reflect->getStartLine(), $reflect->getEndLine());
  80
+}
  81
+
  82
+
  83
+/**
  84
+ * Implements custom drush command for nb-module (moduleinfo).
  85
+ */
  86
+function drush_nbdevel_moduleinfo($alias) {
  87
+	drush_set_option('module-name', $alias);
  88
+	if (module_exists($alias)) {
  89
+	
  90
+		$dependency_list = 'None';
  91
+		$module = drush_get_option('module-name', NULL);
  92
+		$rsc = drush_db_select('system', 'filename', 'name=:name', array(':name' => $module));
  93
+		$filename = drush_db_result($rsc);	 
  94
+		$info_file = drupal_parse_info_file(dirname($filename) . '/' . $module . '.info');
  95
+		if (isset($info_file['dependencies'])) {
  96
+			$dependency_list = implode("\n", $info_file['dependencies']);
  97
+		}
  98
+		
  99
+		drush_print_table(array(
  100
+			array('Name: ', $info_file['name']),
  101
+			array('Description: ', $info_file['description']),
  102
+			array('Version: ', $info_file['version']),
  103
+			array('Module path: ', dirname($filename)),
  104
+			array('Dependencies: ', $dependency_list),
  105
+		),TRUE);
  106
+	}
  107
+	else {
  108
+		drush_print("Couldn't find the ".$alias."-module");
  109
+	}
66 110
 }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.