diff --git a/.gitignore b/.gitignore index ef0869f..f156cf2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ test* swap -_site/* -tmp/ +./site/* +./tmp/ diff --git a/make.sh b/make.sh index 254a13a..c23b978 100755 --- a/make.sh +++ b/make.sh @@ -1,5 +1,5 @@ #!/bin/bash -rootDir='./tmp/' +rootDir='./site/' targetDir='post/' post() { @@ -22,33 +22,38 @@ post() { rm -f $full } -[[ -z $rootDir/post/ ]] && mkdir -p $rootDir/post +_help() { + echo 'Options: + -p [postDirectory/*] + -r (build root pages) + -s (copy stylesheets)' +} +mkdir -p "$rootDir/post" -# root and style page cases where we don't want to do anything else -case $1 in - "s") - cp style.css $rootDir - cp style.css $rootDir/$targetDir - exit 0 - ;; - "r") - echo 'Building the root pages' - targetDir='' - post './prebuild/about.md' - post './prebuild/links.md' - post './prebuild/index.md' - exit 0 - ;; -esac - -for file in $@;do - post $file +# TODO: use getopts to clean this traesh up a bit +while getopts ":srhp:" opt;do + case "$opt" in + s) + cp style.css "$rootDir" # root stylesheet + cp style.css "$rootDir/$targetDir" # post stylesheet + exit 0 + ;; + r) + # Fix targetDir so that it points to the root of the site output + targetDir='' + post './prebuild/about.md' + post './prebuild/links.md' + post './prebuild/index.md' + exit 0 + ;; + p) + for file in ${@:2};do + #echo $file + post $file + done + ;; + h) + _help;; + esac done - -if [ -z $@ ] -then - while read line - do - post $line - done < "${1:-/dev/stdin}" -fi +_help;