informalsystems / themis-contract

A command line-based parameterized contracting tool
Apache License 2.0
46 stars 5 forks source link

Add flag to watch sorce file and recompile on changes #57

Open shonfeder opened 4 years ago

shonfeder commented 4 years ago

When porting a contract I often need to make a change, then recompile to view the results, then make a change. It saves a lot time to have the recompilation performed automatically on safe. I hack this functionality for my purposes with bash function, but it would helpful and convenient to have this functionality built in to the tool.

My bash function runs:

themis-compile-watch () {
  local template="$1"
  local contract="$2"

  if [ -z "$template" ] ||  [ -z "$contract" ]; then
    echo "Must supply a template file and the contract configuration"
    return
  fi

  while inotifywait -e close_write "$template" "$contract"; do
    themis-contract compile "$contract"
  done
}
thanethomson commented 4 years ago

Very cool! 😎