about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xvienna38
1 files changed, 35 insertions, 3 deletions
diff --git a/vienna b/vienna index f7daabc..e32343d 100755 --- a/vienna +++ b/vienna
@@ -1,10 +1,41 @@
1#!/bin/sh 1#!/bin/sh
2# vienna --- a tiny, tasty ssg 2# vienna --- a tiny, tasty ssg
3# by C. Duckworth <acdw@acdw.net> 3# by C. Duckworth <acdw@acdw.net>
4# shellcheck disable=1090,2035
4 5
5### Entry point 6### Entry point
6 7
7configure() { # configure ARG... 8usage() {
9 cat <<EOF
10VIENNA: a tiny, tasty ssg
11by C. Duckworth <acdw@acdw.net>
12
13USAGE: vienna [-h]
14 vienna [-C DIR] [-d DOMAIN] [-o DIR] [COMMAND]
15
16FLAGS:
17 -h view this help
18
19OPTIONS:
20 -C DIR operate in DIR, instead of \$PWD.
21 -d DOMAIN use DOMAIN as basis for urls. default: example.com
22 -o DIR output built site to DIR. default: ./out
23
24PARAMETERS:
25 clean remove output directory before building
26 publish publish the site after building.
27 NOTE: this requires a .vienna.sh file in the site root.
28 you'll have to define a \`publish' function there.
29
30you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG,
31which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so
32you can include shell snippets and variables by doubling the dollar signs.
33
34EOF
35 exit "${1:-0}"
36}
37
38configure() {
8 ## Set up environment 39 ## Set up environment
9 DOMAIN="${VIENNA_DOMAIN:-https://www.example.com}" 40 DOMAIN="${VIENNA_DOMAIN:-https://www.example.com}"
10 TMPD="${VIENNA_TMPD:-/tmp/vienna}" 41 TMPD="${VIENNA_TMPD:-/tmp/vienna}"
@@ -22,11 +53,12 @@ configure() { # configure ARG...
22 # be overridden by command-line flags. 53 # be overridden by command-line flags.
23 test -f "$CONFIG" && . "$CONFIG" 54 test -f "$CONFIG" && . "$CONFIG"
24 ## Parse command line arguments 55 ## Parse command line arguments
25 while getopts d:C:o: opt; do 56 while getopts d:C:o:h opt; do
26 case "$opt" in 57 case "$opt" in
27 C) WORKD="$OPTARG" ;;
28 d) DOMAIN="$OPTARG" ;; 58 d) DOMAIN="$OPTARG" ;;
59 C) WORKD="$OPTARG" ;;
29 o) OUTD="$OPTARG" ;; 60 o) OUTD="$OPTARG" ;;
61 h) usage 0 ;;
30 *) exit 1 ;; 62 *) exit 1 ;;
31 esac 63 esac
32 done 64 done