summaryrefslogtreecommitdiff
path: root/scorsh.sh
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2017-07-19 06:36:00 +0100
committerKatolaZ <katolaz@freaknet.org>2017-07-19 06:36:00 +0100
commit40c8aae58491b07adb05d348d1ddf86ce5ec2be8 (patch)
tree52dae87ff1dc2a65a3fe45be5f18053fb0d62ac1 /scorsh.sh
parent30e2f9e350197cfda09766ef34112e4e3eb261b9 (diff)
Added Licence. Amended Makefile: scorsh -> scorshd. getting closer.
Diffstat (limited to 'scorsh.sh')
-rwxr-xr-xscorsh.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/scorsh.sh b/scorsh.sh
new file mode 100755
index 0000000..4a3a0bd
--- /dev/null
+++ b/scorsh.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+##
+## Rudimentary implementation of a scorsh client, in POSIX sh
+##
+
+## func
+build_command(){
+
+ TAG=$1
+ shift
+ ARGS=$@
+
+ ARGLIST=""
+ for a in ${ARGS}; do
+ ARGLIST="${ARGLIST}\"$a\","
+ done
+ ARGLIST=$(echo ${ARGLIST}| sed -r -e 's/,$//g')
+
+ cmd_str=$(cat <<EOF
+---
+scorsh:
+ [
+ {
+ s_tag: "$TAG",
+ s_args: [${ARGLIST}]
+ }
+ ]
+...
+EOF
+ )
+
+}
+
+
+if [ $# -le 0 ]; then
+ echo "Usage: $0 <tag> [<arg>...]"
+ exit 1
+fi
+
+echo $@
+
+build_command $@
+
+echo $@
+
+echo "${cmd_str}"
+
+echo "$0"
+
+
+## Check if we have to create the commit
+script_name=$(basename $0)
+echo "script_name: ${script_name}"
+if [ "${script_name}" = "scorsh-commit" ]; then
+
+ git commit --allow-empty -Sscorsh -m "${cmd_str}"
+
+fi