From f30c7cb2fd548cd2d350587f858211c92d14296f Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Fri, 24 May 2019 12:29:31 -0700
Subject: [PATCH] Revert "Merge branch 'wordMatching' of
 ssh.gitgud.io:Arkerthan/fc-pregmod into wordMatching"

This reverts commit 542cee1795a582c5a6acbce7cad441cc12d30780
---
 devTools/convert_twscript_to_js.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 devTools/convert_twscript_to_js.sh

diff --git a/devTools/convert_twscript_to_js.sh b/devTools/convert_twscript_to_js.sh
new file mode 100755
index 00000000000..25299d6e92d
--- /dev/null
+++ b/devTools/convert_twscript_to_js.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#converts files in the current dir
+
+# collect files with [script] tag
+FILES=`grep '\[script\]' -H -R * | cut -f 1 -d ':'`
+for f in $FILES; do
+	# create new name. Old name can have any of the following suffixes:
+	# _JS.tw  JS.tw .tw
+	nf="${f%_JS.tw}"
+	nf="${nf%JS.tw}"
+	nf="${nf%.tw}"
+	# we might end up with an empty name, then set dir name as the file name
+	[ -z "$(basename $nf)" -o "${nf: -1}" = "/" ] && nf="${nf}$(basename ${nf})"
+	# append the new suffix
+	nf="${nf}.js"
+	echo "renaming ${f} -> ${nf}"
+	# rename the file
+	git mv "${f}" "${nf}" || echo "renaming ${f} failed"
+	# strip Twee header from it
+	sed -i 1d "${nf}" || echo "stripping Twee header failed for ${nf}"
+	# strip leading empty line '/./,$!d'
+	sed -i '/./,$!d' "${nf}" || echo "Stripping leading empty blank lines failed for ${nf}"
+done
-- 
GitLab