Skip to content

Instantly share code, notes, and snippets.

@rntz
Created August 23, 2018 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rntz/39b662726d9a15f3d258f11703827383 to your computer and use it in GitHub Desktop.
Save rntz/39b662726d9a15f3d258f11703827383 to your computer and use it in GitHub Desktop.
Shell & sed script to generate a graphviz file with agda dependencies
#!/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