From: Siraaj Khandkar Date: Fri, 3 Jan 2020 20:02:55 +0000 (-0500) Subject: Add script to prepare and deploy README for gitweb X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=4c7109544579c7619282437cc1e3f29005c96ba9;p=khome.git Add script to prepare and deploy README for gitweb --- 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