From c3c14ffdead37172ac9a34220379ccbaa562c309 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 8 Jan 2023 23:59:23 -0600 Subject: Change $DOMAIN to $URL_ROOT --- vienna | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/vienna b/vienna index 9fd4a42..e192776 100755 --- a/vienna +++ b/vienna @@ -11,7 +11,7 @@ VIENNA: a tiny, tasty ssg by C. Duckworth USAGE: vienna [-h] - vienna [-q] [-c CONFIG] [-C DIR] [-d DOMAIN] [-o DIR] [COMMAND] + vienna [-q] [-c CONFIG] [-C DIR] [-o DIR] [-r URL] [COMMAND...] FLAGS: -h view this help @@ -20,18 +20,18 @@ FLAGS: OPTIONS: -c FILE use FILE as configuration. [default: $VIENNA_CONFIG] -C DIR operate in DIR, instead of \$PWD. - -d DOMAIN use DOMAIN as basis for urls. [default: example.com] -o DIR output built site to DIR. [default: ./out] + -r URL use URL as basis for urls. [default: example.com] -PARAMETERS: +COMMANDS: init initialize a vienna site with minimalist defaults and exit. clean remove output directory before building. - publish publish the site after building. - NOTE: this requires a .vienna.sh file in the site root. - you'll have to define a \`publish' function there. preview preview the site locally after building. NOTE: this requires a .vienna.sh file in the site root. you'll have to define a \`preview' function there. + publish publish the site after building. + NOTE: this requires a .vienna.sh file in the site root. + you'll have to define a \`publish' function there. you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG, which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so @@ -43,7 +43,7 @@ EOF configure() { ## Set up environment - DOMAIN="${VIENNA_DOMAIN:-https://www.example.com}" + URL_ROOT="${VIENNA_URL_ROOT:-https://www.example.com}" TEMPDIR="${VIENNA_TEMPDIR:-/tmp/vienna}" WORKDIR="${VIENNA_WORKDIR:-$PWD}" OUTDIR="${VIENNA_OUTDIR:-out}" @@ -58,8 +58,10 @@ configure() { # Logging LOG=true ## Parse command line arguments - while getopts C:c:d:ho:q opt; do + while getopts hqC:c:o:r: opt; do case "$opt" in + h) usage 0 ;; + q) LOG=false ;; C) WORKDIR="$OPTARG" ;; c) CONFIG="$OPTARG" @@ -67,10 +69,8 @@ configure() { # line but doesn't exist. CONFIG_ARG=1 ;; - d) DOMAIN="$OPTARG" ;; - h) usage 0 ;; o) OUTDIR="$OPTARG" ;; - q) LOG=false ;; + r) URL_ROOT="$OPTARG" ;; *) exit 1 ;; esac done @@ -113,8 +113,8 @@ main() { fi log vienna config # Log configuration variables - log config domain: "$DOMAIN" - log config workdir: "$WORKDIR" + log config 'base url': "$URL_ROOT" + log config 'work dir': "$WORKDIR" log config output: "$OUTDIR" log template page: "$PAGE_TEMPLATE" log template index: "$INDEX_TEMPLATE" @@ -229,7 +229,9 @@ initialize() { # initialize log init "$CONFIG" cat >"$CONFIG" <