From 4c7109544579c7619282437cc1e3f29005c96ba9 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Fri, 3 Jan 2020 15:02:55 -0500 Subject: [PATCH] Add script to prepare and deploy README for gitweb --- home/bin/git-readme | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 home/bin/git-readme diff --git a/home/bin/git-readme b/home/bin/git-readme new file mode 100755 index 0000000..ef7ade4 --- /dev/null +++ b/home/bin/git-readme @@ -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 -- 2.20.1