Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codyphobe/d7010a7e7c0c09f1100f0045234a03ec to your computer and use it in GitHub Desktop.
Save codyphobe/d7010a7e7c0c09f1100f0045234a03ec to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function pw {
# Set the command that should run when changes are detected
run="clear && printf '\e[3J' && vendor/bin/phpunit"
# Retrieve the custom arguments, defaulting to "tests"
[[ -n $@ ]] && args=$@ || args="tests"
# Run the command first...
eval "$run $args"
# ...then start watching for changes and run again on each change
watchman-make \
# Set the files and folders to be watched
-p 'app/**/*.php' 'database/**/*.php' 'src/**/*.php' 'tests/**/*.php' \
--make=$run \
-t "$args"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment