mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
cleanup: make work based on location if target not specified
This commit is contained in:
parent
8b90f211ed
commit
87e3108296
1 changed files with 24 additions and 14 deletions
|
@ -2,25 +2,21 @@
|
||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
DIRS=""
|
DIR=""
|
||||||
VARIANT=""
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
[ $# -ge 1 ] && echo "ERROR: $1"
|
[ $# -ge 1 ] && echo "ERROR: $1"
|
||||||
echo "usage: $0 [--dest-dir <dir>]*"
|
echo "usage: $0 [--dir <dir>]"
|
||||||
|
echo " uses variant parent of CWD as default if not provided"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
echo "\"$1\""
|
echo "\"$1\""
|
||||||
case $1 in
|
case $1 in
|
||||||
--variant-name)
|
--dir)
|
||||||
shift
|
shift
|
||||||
VARIANT=$1
|
DIR="$DIR $1"
|
||||||
;;
|
|
||||||
--dest-dir)
|
|
||||||
shift
|
|
||||||
DIRS="$DIRS $1"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unexpected param $1"
|
usage "unexpected param $1"
|
||||||
|
@ -29,12 +25,26 @@ while [ $# -ge 1 ]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
for DIR in $DIRS; do
|
if [ -z "$DIR" ]; then
|
||||||
|
while :; do
|
||||||
|
WD=$(pwd)
|
||||||
|
if [ "/" = "$WD" ]; then
|
||||||
|
echo "reached / without finding AndroidManifest.xml"
|
||||||
|
exit 1
|
||||||
|
elif [ -e ${WD}/AndroidManifest.xml ]; then
|
||||||
|
DIR=$WD
|
||||||
|
break
|
||||||
|
else
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
for FILE in $(find $DIR -type f); do
|
for FILE in $(find $DIR -type f); do
|
||||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||||
echo "skipping $FILE; it's under version control within this variant"
|
echo "skipping $FILE; it's under version control within this variant"
|
||||||
else
|
else
|
||||||
|
echo "removing $FILE"
|
||||||
rm $FILE
|
rm $FILE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in a new issue