| 1 | #! /bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | exe="$0" |
| 6 | cmd="push" |
| 7 | remote="$1" |
| 8 | |
| 9 | usage() { |
| 10 | printf 'Usage: %s REMOTE\n' "$exe" |
| 11 | exit 1 |
| 12 | } |
| 13 | |
| 14 | case "$cmd" in |
| 15 | push) ;; |
| 16 | *) usage ;; |
| 17 | esac |
| 18 | |
| 19 | case "$remote" in |
| 20 | '') usage ;; |
| 21 | *) ;; |
| 22 | esac |
| 23 | |
| 24 | file_src='README.md' |
| 25 | file_out='README.html' |
| 26 | |
| 27 | pandoc "$file_src" > "$file_out" |
| 28 | |
| 29 | local_path="$file_out" |
| 30 | remote_url=$(git remote get-url "$remote") |
| 31 | remote_path="${remote_url}/$file_out" |
| 32 | |
| 33 | case "$cmd" in |
| 34 | push) scp "$local_path" "$remote_path";; |
| 35 | pull) scp "$remote_path" "$local_path";; |
| 36 | esac |