Upload functions are now just wrappers around a more fundamental function
Features - - full html reupload => -h - folder html reupload => f [FOLDER] - root html reupload => r
This commit is contained in:
parent
6f1162b778
commit
9d9672a320
57
upload.sh
57
upload.sh
@ -6,26 +6,57 @@ url="https://neocities.org"
|
|||||||
auth="Authorization: Bearer $KEY"
|
auth="Authorization: Bearer $KEY"
|
||||||
site=.mirror
|
site=.mirror
|
||||||
|
|
||||||
html() {
|
_upload_html() {
|
||||||
# Total reupload of the site's html
|
if [ ${1:0:1} = "" ];then
|
||||||
pushd $site > /dev/null
|
echo Path must start with ./
|
||||||
echo `pwd`
|
exit 1
|
||||||
for f in $(find -name '*.html');do
|
fi
|
||||||
|
for f in $@;do
|
||||||
remote_path=${f:1}
|
remote_path=${f:1}
|
||||||
curl -H "$auth" -F "$remote_path=@$f" $url/api/upload
|
curl -H "$auth" -F "$remote_path=@$f" $url/api/upload
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
html() {
|
||||||
|
# Total reupload of the site's html
|
||||||
|
_upload_html $(find -name '*.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
roots() {
|
||||||
|
_upload_html ./*.html
|
||||||
|
}
|
||||||
|
|
||||||
|
folder() {
|
||||||
|
if [ -z $1];then
|
||||||
|
echo No folder specified > /dev/stderr
|
||||||
|
else
|
||||||
|
pushd $1 > /dev/null
|
||||||
|
_upload_html ./*.html
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_help() {
|
||||||
|
cat <<EOF
|
||||||
|
Options:
|
||||||
|
h => Reuploads all the html content
|
||||||
|
r => Uploads all root html pages
|
||||||
|
f [FOLDER] => Upload all html in [FOLDER]
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z $1 ];then
|
if [ -z $1 ];then
|
||||||
cat <<EOF
|
_help
|
||||||
Options:
|
|
||||||
folder [name] - rebuilds html of that folder
|
|
||||||
page [remote path] - single page is rebuilt
|
|
||||||
html - rebuilds the html of the site
|
|
||||||
media - recopies the media desired
|
|
||||||
EOF
|
|
||||||
else
|
else
|
||||||
for cmd in $@;do $cmd;done
|
pushd $site > /dev/null
|
||||||
|
while getopts ':Hhrf:' opt;do
|
||||||
|
case $opt in
|
||||||
|
H) _help;;
|
||||||
|
h) _upload_html $(find -name '*.html');; # Upload all html content
|
||||||
|
r) _upload_html ./*.html;; # Upload all root html pages
|
||||||
|
f) _upload_html $1/*.html;;# Upload html in the spec'd folder
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user