Skip to content

Instantly share code, notes, and snippets.

@timmc
Last active September 7, 2016 18:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save timmc/7359898 to your computer and use it in GitHub Desktop.
Save timmc/7359898 to your computer and use it in GitHub Desktop.
debug-compilation.sh: Emit progress to stdout as your Clojure compiles.
#!/bin/bash
# Munge your codebase to add :verbose on all :require and :use forms and insert printlns in front of defns.
# $1: Path to directory you want to munge files in (recursively).
# WARNING: There is not an easy way to reverse this script, so commit your work beforehand
# and undo the munging with `git reset --hard HEAD` or similar.
find "$1" -name '*.clj' -exec sed -i 's/\((defn\? \([a-z0-9<>_*+-]\+\)\)/(println "var \2")\n\1/' '{}' \;
find "$1" -name '*.clj' -exec sed -i 's/:\(require\|use\) /:\1 :verbose /' '{}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment