Created
August 23, 2018 12:23
-
-
Save rntz/39b662726d9a15f3d258f11703827383 to your computer and use it in GitHub Desktop.
Shell & sed script to generate a graphviz file with agda dependencies
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 | |
set -e | |
echo "digraph {" | |
# Generate the node names. | |
find . -iname '*.agda' '!' -name '.*' | | |
sed -Ee 's,^\./,,;s,.agda$,,;s,/,.,g;s/.*/"&" [label="&"];/' | |
# Generate edges. | |
find . -iname '*.agda' '!' -name '.*' | | |
xargs egrep -o 'import [[:alnum:].]+' | | |
sed -Ee 's,^\./,",; s,\.agda,,; s,/,.,g; s,:import ," -> ",; s,$,";,' | |
echo "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment