commit a0b801f064aac0cc3e533e019fd3d61a0cf27e94
parent 766ca83d02970602af64554695c442c503e5772e
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Wed, 17 Aug 2022 18:29:01 -0400
Add "push" command to facilitate quick publishing
The push command executes an arbitrary command specified in config.ini
under the "pushcmd" variable.
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sbs b/sbs
@@ -35,6 +35,7 @@ new()
printf "blogDir = blog/\n"
printf "languageCode = en\n"
printf "buildOptions = -Thtml --html-no-skiphtml --html-no-escapehtml\n"
+ printf "pushcmd = echo 'No command configured.'\n"
} > "$3/config.ini"
# Create template header.html file
{ printf '<!DOCTYPE html>\n'
@@ -68,7 +69,7 @@ new()
parse_configuration()
{
- options="siteURL siteName blogDir languageCode buildOptions"
+ options="siteURL siteName blogDir languageCode buildOptions pushcmd"
for key in $options; do
value=$(grep "$key" config.ini | cut -d'=' -f2 | xargs)
if [ -n "$value" ]; then
@@ -167,6 +168,13 @@ build()
done
}
+# Push the contents of the static/ folder using the configured command
+push()
+{
+ echo "$pushcmd"
+ sh -c "$pushcmd"
+}
+
case "$1" in
"build")
shift
@@ -180,6 +188,10 @@ case "$1" in
"new")
new "$@"
;;
+ "push")
+ parse_configuration
+ push
+ ;;
"version")
echo "v0.3.0" ;
;;