]> git.mdlowis.com Git - projs/tide.git/commitdiff
added tools dir
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 2 Mar 2018 02:04:24 +0000 (21:04 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 2 Mar 2018 02:04:24 +0000 (21:04 -0500)
tools/c+ [new file with mode: 0755]
tools/c- [new file with mode: 0755]
tools/i+ [new file with mode: 0755]
tools/i- [new file with mode: 0755]
tools/lang [new file with mode: 0755]
tools/trim [new file with mode: 0755]

diff --git a/tools/c+ b/tools/c+
new file mode 100755 (executable)
index 0000000..fa23571
--- /dev/null
+++ b/tools/c+
@@ -0,0 +1,5 @@
+#!/bin/sh
+case "$(lang "$file")" in
+    C) sed 's/^/\/\//g' "$@" ;;
+    *) sed 's/^/#/g' "$@" ;;
+esac
diff --git a/tools/c- b/tools/c-
new file mode 100755 (executable)
index 0000000..93107ad
--- /dev/null
+++ b/tools/c-
@@ -0,0 +1,5 @@
+#!/bin/sh
+case "$(lang "$file")" in
+    C) sed 's/^\/\///g' "$@" ;;
+    *) sed 's/^#//g' "$@" ;;
+esac
diff --git a/tools/i+ b/tools/i+
new file mode 100755 (executable)
index 0000000..13a0f95
--- /dev/null
+++ b/tools/i+
@@ -0,0 +1,6 @@
+#!/bin/sh
+case "$(lang "$file")" in
+    ML|Python|Ruby)
+        sed 's/^/  /g' "$@" ;;
+    *)  sed 's/^/    /g' "$@" ;;
+esac
diff --git a/tools/i- b/tools/i-
new file mode 100755 (executable)
index 0000000..a9ec504
--- /dev/null
+++ b/tools/i-
@@ -0,0 +1,6 @@
+#!/bin/sh
+case "$(lang "$file")" in
+    ML|Python|Ruby)
+        sed 's/^  //g' "$@" ;;
+    *)  sed 's/^    //g' "$@" ;;
+esac
diff --git a/tools/lang b/tools/lang
new file mode 100755 (executable)
index 0000000..8c1806f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+case "$1" in
+    *.c|*.cpp|*.cc|*.h|*.hpp)
+        echo "C" ;;
+    *.ml) echo "ML" ;;
+    *.py) echo "Python" ;;
+    *.rb) echo "Ruby" ;;
+    *)    echo "Text" ;;
+esac
diff --git a/tools/trim b/tools/trim
new file mode 100755 (executable)
index 0000000..e50e722
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+sed 's/ *$//g' "$@"