1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash

set -euo pipefail
if [[ "${TRACE-0}" == "1" ]]; then
    set -o xtrace
fi

readonly HOST="${GISTS_HOST:-lotus-land-story}"
readonly DEST="${GISTS_DEST:-/mnt/lotus-land-story/caddy/data/gists}"

main() {
    local root
    root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

    rsync \
        --archive \
        --compress \
        --itemize-changes \
        --include='*.html' \
        --include='*.md' \
        --exclude='*' \
        "$@" \
        "$root/" "$HOST:$DEST/"
}

main "$@"