Skip to content

Commit 023c918

Browse files
author
Rafael Basask
committed
kkgit with maxdepth 2
1 parent 29ac330 commit 023c918

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

kkclean

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ else
2626
echo -e "${FMT_BOLD}No ${CL_OK}*.pyc${CL_RESET}${FMT_BOLD} files found.${FMT_RESET}"
2727
fi
2828

29+
function clean_migrations {
30+
find $1 -not -name '__init__.py' -not -type d -delete
31+
}
32+
export -f clean_migrations
33+
2934
migrations=`find . -name migrations -not -path "*/.git/*"`
3035
if [ -n "$migrations" ]; then
3136
echo -e "${FMT_BOLD}The following dirs will be deleted:${FMT_RESET}"
3237
for mig in $migrations; do
3338
echo -e "\t$CL_ERR$mig$CL_RESET"
3439
done
35-
confirm "Delete all files? [Y/n]" && find . -name migrations -not -path "*/.git/*" -prune -exec rm -rf {} \;
40+
confirm "Delete all files? [Y/n]" && find . -name migrations -not -path "*/.git/*" -prune -exec bash -c 'clean_migrations "$0"' {} \;
3641
else
3742
echo -e "${FMT_BOLD}No ${CL_OK}migrations${CL_RESET}${FMT_BOLD} files found.${FMT_RESET}"
3843
fi

kkgit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function gitpath {
4141
RESP=0
4242
confirm "Auto confirm? [Y/n]" && RESP=1
4343

44-
for i in `find . -name '.git'`
44+
for i in `find . -maxdepth 2 -name '.git'`
4545
do
4646
DIR=$(dirname "${i}")
4747

0 commit comments

Comments
 (0)