#!/usr/bin/env bash set -eo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd $SCRIPT_DIR function update-reveal-js(){ pushd reveal.js/ > /dev/null git --work-tree="../$1/reveal.js" checkout HEAD -- . git checkout $(cat "../$1/reveal.js/VERSION" &> /dev/null || printf ".") git rev-parse HEAD > "../$1/VERSION" popd > /dev/null } [ -n "$1" ] || { echo "Missing folder name as argument." exit 1 } outdir="$1" mkdir -p "$outdir/reveal.js" cp base.org "$outdir/index.org" update-reveal-js $outdir