2 # - arguments will be exported to env
3 # - must called from within the repo root
5 export REPO
=$
(basename $
(pwd) .git
)
13 for FILE
in $
(ls -a $
(dirname -- $0)/presets
)
15 SRCFILE
=$
(dirname -- $0)/presets
/$FILE
21 test "${COMPOSER+set}" = "" && continue
22 SRCFILE
=$
(mktemp
-t $RANDOM)
23 php
-d variables_order
=E $
(dirname -- $0)/presets
/composer.json
>$SRCFILE
26 test "${PECL+set}" = "" && continue
27 SRCFILE
=$
(mktemp
-t $RANDOM)
28 php
-d variables_order
=E $
(dirname -- $0)/presets
/package.xml
>$SRCFILE
31 SRCFILE
=$
(mktemp
-t $RANDOM)
32 php
-d variables_order
=E $
(dirname -- $0)/presets
/README.md
>$SRCFILE
40 DIFF
="diff -udbBE -- $SRCFILE $FILE"
41 # ignore changes with only additions or removals
42 if ! $DIFF |
awk '{if(NR<4){next}}/^-/{if(p){exit 1}m++}/^\+/{if(m){exit 1}p++}'
44 while read -n 1 -p "File $FILE exists and differs (q,s,r,d,v,?) " ACTION
52 cp -fv -- $SRCFILE $FILE
59 vimdiff
-- $SRCFILE $FILE
65 echo "Select what to do now:"
66 echo " (q)uit and exit program now"
67 echo " (s)kip this file an keep the existing"
68 echo " (r)eplace the existing file with the preset"
69 echo " (d)iff the two files -udbBE"
70 echo " (v)imdiff the two files"