JavaScript, Json minimizator

jsmin – is a JavaScript, Json minimizator which removes comments and unnecessary whitespace from JS, JSON files

2 Commits   0 Branches   0 Tags
author: kx <kx@radix.pro> 2023-04-07 06:34:02 +0300 committer: kx <kx@radix.pro> 2023-04-07 06:34:02 +0300 commit: f84701650cb9f48ae55290e4091d70b334b907d5 parent: 890f8e901f0ea339efae789a00ac4fc561303e29
Commit Summary:
Version 0.0.1
Diffstat:
1 file changed, 31 insertions, 0 deletions
diff --git a/auto-clean b/auto-clean
new file mode 100755
index 0000000..84d1b59
--- /dev/null
+++ b/auto-clean
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+CWD=`pwd`
+
+program=`basename $0`
+
+usage() {
+  cat << EOF
+
+Usage: $program [options]
+
+Options:
+  -h,--help                  Display this message.
+
+EOF
+}
+
+if [ -f "${CWD}/Makefile" ] ; then
+  make distclean
+fi
+
+gitignore='.gitignore'
+
+while read ln; do
+  line=`echo "${ln}" | sed 's,^[ \t],,' | sed 's,[ \t]$,,'`
+  if [ "x$line" != "x" -a "${line:0:1}" != "#" ] ; then
+    if `echo "${line}" | grep -q '\*~$'` ; then
+      find "`dirname "${line}"`" -type f -iname '*~' -print0 | while IFS= read -r -d '' file ; do
+        rm -f "$file"
+      done
+    elif `echo "${line}" | grep -q '\*'` ; then
+      find "`dirname "${line}"`" -type f -iname "`basename "${line}"`" -print0 | while IFS= read -r -d '' file ; do
+        rm -f "$file"
+      done
+    else
+      if [ -d "${line}" ] ; then rm -rf "${line}" ; fi
+      if [ -f "${line}" ] ; then rm  -f "${line}" ; fi
+    fi
+  fi
+done < ${CWD}/${gitignore}