switched to getopts in build script
This commit is contained in:
parent
e4d84c18f1
commit
ddd9aa4a6e
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,5 +2,5 @@
|
|||||||
test*
|
test*
|
||||||
|
|
||||||
swap
|
swap
|
||||||
_site/*
|
./site/*
|
||||||
tmp/
|
./tmp/
|
||||||
|
63
make.sh
63
make.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
rootDir='./tmp/'
|
rootDir='./site/'
|
||||||
targetDir='post/'
|
targetDir='post/'
|
||||||
|
|
||||||
post() {
|
post() {
|
||||||
@ -22,33 +22,38 @@ post() {
|
|||||||
rm -f $full
|
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
|
# TODO: use getopts to clean this traesh up a bit
|
||||||
case $1 in
|
while getopts ":srhp:" opt;do
|
||||||
"s")
|
case "$opt" in
|
||||||
cp style.css $rootDir
|
s)
|
||||||
cp style.css $rootDir/$targetDir
|
cp style.css "$rootDir" # root stylesheet
|
||||||
exit 0
|
cp style.css "$rootDir/$targetDir" # post stylesheet
|
||||||
;;
|
exit 0
|
||||||
"r")
|
;;
|
||||||
echo 'Building the root pages'
|
r)
|
||||||
targetDir=''
|
# Fix targetDir so that it points to the root of the site output
|
||||||
post './prebuild/about.md'
|
targetDir=''
|
||||||
post './prebuild/links.md'
|
post './prebuild/about.md'
|
||||||
post './prebuild/index.md'
|
post './prebuild/links.md'
|
||||||
exit 0
|
post './prebuild/index.md'
|
||||||
;;
|
exit 0
|
||||||
esac
|
;;
|
||||||
|
p)
|
||||||
for file in $@;do
|
for file in ${@:2};do
|
||||||
post $file
|
#echo $file
|
||||||
|
post $file
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
_help;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
_help;
|
||||||
if [ -z $@ ]
|
|
||||||
then
|
|
||||||
while read line
|
|
||||||
do
|
|
||||||
post $line
|
|
||||||
done < "${1:-/dev/stdin}"
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user