Skip to content

Instantly share code, notes, and snippets.

@rapha
Created April 30, 2009 07:55
Show Gist options
  • Save rapha/104332 to your computer and use it in GitHub Desktop.
Save rapha/104332 to your computer and use it in GitHub Desktop.
Visualise the class hierarchy in a Java project with this script
#!/bin/bash
DIR=$1
FORMAT=${2:-'pdf'}
FILENAME="hierarchy.$FORMAT"
cat \
<(echo 'digraph types {') \
<(ack '(class|interface) \w+ (extends|implements) \w+' --java -h -o $DIR | \
awk '{print "\"" $4 "\"", "->", "\"" $2 "\""}') \
<(echo '}') \
| dot -T$FORMAT >$FILENAME && open $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment