Created
March 18, 2014 14:24
-
-
Save krisahil/9621094 to your computer and use it in GitHub Desktop.
List info about all contrib modules available on a Drupal site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tmp="/tmp/temp-file" | |
alias="" | |
# List all contrib modules. | |
for name in $(drush $alias sql-query "SELECT name FROM system WHERE type = 'module' AND filename LIKE 'sites/all/modules%'"); do | |
# Skip header row. | |
if [[ "name" == $name ]]; then | |
continue | |
fi | |
drush $alias pmi $name > $tmp | |
# Parse the output for each facet, and use sed to trim whitespace. | |
version=$(grep '^ Version' $tmp | cut -d \: -f2 | sed 's/ *$//' | sed 's/^ *//') | |
title=$(grep '^ Title' $tmp | cut -d \: -f2 | sed 's/ *$//' | sed 's/^ *//') | |
desc=$(grep '^ Description' $tmp | cut -d \: -f2 | sed 's/ *$//' | sed 's/^ *//') | |
project=$(grep '^ Project' $tmp | cut -d \: -f2 | sed 's/ *$//' | sed 's/^ *//') | |
# Format into human readable. | |
echo "$title (http://www.drupal.org/project/$project, $version): $desc" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment