Created
August 7, 2015 20:52
-
-
Save mzabriskie/0da45b077f52b1f5d58a to your computer and use it in GitHub Desktop.
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 -e | |
dir="$1" | |
# No dir provided | |
if [ -z "$dir" ] | |
then | |
dir="`pwd`" | |
fi | |
# Make sure dir ends with "/" | |
if [[ $dir != */ ]] | |
then | |
dir="$dir/*" | |
else | |
dir="$dir*" | |
fi | |
LG='\033[1;32m' | |
NC='\033[0m' | |
# Loop sub directories | |
for f in $dir | |
do | |
# Only care about directories | |
[ -d "${f}" ] || continue | |
name=$(node -p "require('$f/package').name") | |
version=$(node -p "require('$f/package').version") | |
echo -e $name ${LG}$version${NC} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment