Add script to prepare and deploy README for gitweb
authorSiraaj Khandkar <siraaj@khandkar.net>
Fri, 3 Jan 2020 20:02:55 +0000 (15:02 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Fri, 3 Jan 2020 20:02:55 +0000 (15:02 -0500)
home/bin/git-readme [new file with mode: 0755]

diff --git a/home/bin/git-readme b/home/bin/git-readme
new file mode 100755 (executable)
index 0000000..ef7ade4
--- /dev/null
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+set -e
+
+exe="$0"
+cmd="push"
+remote="$1"
+
+usage() {
+    printf 'Usage: %s REMOTE\n' "$exe"
+    exit 1
+}
+
+case "$cmd" in
+    push) ;;
+    *) usage ;;
+esac
+
+case "$remote" in
+    '') usage ;;
+    *) ;;
+esac
+
+file_src='README.md'
+file_out='README.html'
+
+pandoc "$file_src" > "$file_out"
+
+local_path="$file_out"
+remote_url=$(git remote get-url "$remote")
+remote_path="${remote_url}/$file_out"
+
+case "$cmd" in
+    push) scp  "$local_path" "$remote_path";;
+    pull) scp "$remote_path"  "$local_path";;
+esac
This page took 0.027059 seconds and 4 git commands to generate.