diff --git a/processor b/processor index e3583d0..9f5ec94 100755 --- a/processor +++ b/processor @@ -27,10 +27,11 @@ cat < - Mike Gerwitz's Thoughts and Ramblings + $title -

Mike Gerwitz's Thoughts and Ramblings

+

$title

+

$desc

EOH @@ -60,7 +61,7 @@ while read hash commit ts id subject; do fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )" [ "$prevdate" == "$dategroup" ] || { - echo "

$dategroup

" + echo "

$dategroup

" } printf '' \ @@ -91,7 +92,7 @@ fi cat <
-
Copyright © $yearrange Mike Gerwitz
+
Copyright © $yearrange $copyright
Last Updated: $( printf "%(%F %H:%M:%S)T" "$lastts" )
$lasthash
diff --git a/repo2html b/repo2html index 35e6fac..3055f14 100755 --- a/repo2html +++ b/repo2html @@ -32,9 +32,42 @@ else exit 128 fi +# store our cwd and enter our own (to make invoking relative scripts easier) path_out="$( pwd )" path="$( dirname "$0" )" cd "$path" +# provides configuration warning and outputs a default +cwarn() +{ + echo "Warning: no $1 provided; defaulting to: ${2:-(empty)}" >&2 + echo "$2" +} + +# configuration (note that this setup in conjunction with the below defaults +# imply that they can be passed in as environment variables as an alternative to +# options) +while getopts t:d:c:l: opt; do + case "$opt" in + t) title="$OPTARG";; + d) desc="$OPTARG";; + c) copyright="$OPTARG";; + l) license="$OPTARG";; + ?) exit 64;; + esac +done + +# default title to repository name (as taken from the directory) +title="${title:-$( cwarn title $( basename "$path_out" ) )}" +desc="${desc:-$( cwarn description )}" + +# default to a restrictive copyright (unfortunately, that's the best we can do, +# since copyright is restrictive by default) +copyright="${copyright:-$( cwarn copyright 'Respective Authors' )}" +license="${license:-$( cwarn license )}" + +# make configuration available to all scripts +export title desc copyright license + # pass commit list to the processor "$repotype"/list | ./processor "$repotype" "$path_out" diff --git a/tpl/commit.sh b/tpl/commit.sh index 1216f2f..3ca3656 100755 --- a/tpl/commit.sh +++ b/tpl/commit.sh @@ -19,9 +19,8 @@ cat <