File tree Expand file tree Collapse file tree 1 file changed +30
-6
lines changed Expand file tree Collapse file tree 1 file changed +30
-6
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ CL_ERR=" \e[31m"
4+ CL_OK=" \e[32m"
5+ CL_RESET=" \033[0m\e[0m"
6+ FMT_BOLD=$( tput bold)
7+ FMT_RESET=$( tput sgr0)
8+
9+ confirm () {
10+ read -r -p " ${1:- Delete all files? [Y/n]} " choose
11+ case $choose in
12+ [Nn])
13+ false
14+ ;;
15+ * )
16+ true
17+ ;;
18+ esac
19+ }
20+
321count=` find . -name * .pyc | wc -l`
422if [ $count -gt 0 ]; then
523 find . -name " *.pyc" -delete
6- echo " $count *.pyc deleted!"
24+ echo -e " ${CL_OK} $count ${CL_RESET}${FMT_BOLD} *.pyc deleted!${FMT_RESET} "
25+ else
26+ echo -e " ${FMT_BOLD} No ${CL_OK} *.pyc${CL_RESET}${FMT_BOLD} files found.${FMT_RESET} "
727fi
828
9- count=` find . -name migrations | wc -l`
10- if [ $count -gt 0 ]; then
11- echo " $count migrations found!"
12- echo " Choose [y/n] for each one to delete:"
13- find . -name " migrations" -exec echo -n " " \; -ok rm -rf {} \;
29+ migrations=` find . -name migrations`
30+ if [ -n " $migrations " ]; then
31+ echo -e " ${FMT_BOLD} The following dirs will be deleted:${FMT_RESET} "
32+ for mig in $migrations ; do
33+ echo -e " \t$CL_ERR$mig$CL_RESET "
34+ done
35+ confirm " Delete all files? [Y/n]" && find . -name migrations -prune -exec rm -rf {} \;
36+ else
37+ echo -e " ${FMT_BOLD} No ${CL_OK} migrations${CL_RESET}${FMT_BOLD} files found.${FMT_RESET} "
1438fi
You can’t perform that action at this time.
0 commit comments