Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # required to be able to input the response
- exec < /dev/tty
- # require to exit the docker container and kill the process
- trap printout SIGINT
- printout() {
- exit
- }
- cmd_dry="$(pwd)/bin/php-cs-fixer fix --dry-run --diff";
- cmd_fix="$(pwd)/bin/php-cs-fixer fix --diff";
- while true; do
- read -p "Run Linter? (Y/n) " -n 1 -t 4 yn
- if [[ ${yn} = "" ]]; then
- yn='Y';
- fi
- case ${yn} in
- [Yy])
- ${cmd_dry};
- status=$?;
- if [[ ${status} -eq 0 ]]; then
- exit ${status};
- fi
- ${cmd_fix};
- exit ${status};
- ;;
- [Nn])
- exit 0;
- ;;
- *)
- echo "Please answer y or n for yes or no."
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement