git.iko.soy/typeable/pandoc
on master help sign in
Update diff-zip to support windows (#5641)

Trying to use this script on windows (git-bash) gave several errors: - *mktemp* complained about missing XXXs in the template (fixed by adding XXX) - *find* didn't understand the -E switch (fixed by using the equivalent arguments) - *terminal codes* were not being recognized by the console (-e added to echo)

commit61346163524f9a1447604d45996e1c6e924333f1 authorAgustín Martín Barbero <agusmbaterra@gmail.com> dateFri 12 Jul 2019, 18:08 (7 years ago) parent83a0104
1 file changed+3−3
tools/diff-zip.sh+3−3
tools/diff-zip.sh+3−3
@@ -9,7 +9,7 @@ f2="$2"
99test -f "$f1" -a -f "$f2" || {
1010 echo "Usage: diff-zip firstfile secondfile" && exit 1
1111}
12−WORKDIR=$(mktemp -d -t diff-zip)
12+WORKDIR=$(mktemp -d -t diff-zip.XXX)
1313trap "{ rm -r $WORKDIR; }" EXIT
1414unzip -q -d "$WORKDIR/a" "$f1"
1515unzip -q -d "$WORKDIR/b" "$f2"
@@ -17,10 +17,10 @@ cd "$WORKDIR"
1717mkdir tidy
1818for x in a b; do
1919 cp -r $x tidy/
20− find -E $x -iregex '.*\.(xhtml|xml|rdf|rels)' -exec sh -c 'mkdir -p "$(dirname tidy/$1)" && tidy -q -xml -utf8 -i "$1" > "tidy/$1"' _ {} \;
20+ find $x -regextype posix-extended -iregex '.*\.(xhtml|xml|rdf|rels)' -exec sh -c 'mkdir -p "$(dirname tidy/$1)" && tidy -q -xml -utf8 -i "$1" > "tidy/$1"' _ {} \;
2121done
2222cd tidy
2323mkdir c
2424cp -r a/* c/
2525cp -r b/* c/
26−find c -type f -exec sh -c 'echo "\033[1m=== ${1#*/} ===\033[0m" ; diff -u "a/${1#*/}" "b/${1#*/}" 2>&1' _ {} \;
26+find c -type f -exec sh -c 'echo -e "\033[1m=== ${1#*/} ===\033[0m" ; diff -u "a/${1#*/}" "b/${1#*/}" 2>&1' _ {} \;