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 SRCFILE
=$
(mktemp
-t $RANDOM)
27 php
-d variables_order
=E $
(dirname -- $0)/presets
/README.md
>$SRCFILE
35 DIFF
="diff -udbBE -- $SRCFILE $FILE"
36 # ignore changes with only additions or removals
37 if ! $DIFF |
awk '{if(NR<4){next}}/^-/{if(p){exit 1}m++}/^\+/{if(m){exit 1}p++}'
39 while read -n 1 -p "File $FILE exists and differs (q,s,r,d,v,?) " ACTION
47 cp -fv -- $SRCFILE $FILE
54 vimdiff
-- $SRCFILE $FILE
60 echo "Select what to do now:"
61 echo " (q)uit and exit program now"
62 echo " (s)kip this file an keep the existing"
63 echo " (r)eplace the existing file with the preset"
64 echo " (d)iff the two files -udbBE"
65 echo " (v)imdiff the two files"