From 1e539fbe467c359c364a3cdfdc5b27f666a562b1 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 4 Oct 2022 22:47:49 -0500 Subject: refactor pre- and post-processing --- vienna | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/vienna b/vienna index 0ae7027..90e5c03 100755 --- a/vienna +++ b/vienna @@ -91,17 +91,9 @@ main() { configure "$@" shift "$((OPTIND - 1))" # Further argument processing --- pre-build - case "${1:-ok}" in - ok) ;; - clean) - log vienna "clean" - rm -r "$OUTD" - exit - ;; - esac + preprocess "$@" # Prepare cd "$WORKD" || exit 2 - test -f "$CONFIG" && . "$CONFIG" # Source ./.vienna.sh, if it exists. if test -f "$CONFIG"; then # Source ./.vienna.sh, if it exists. . "$CONFIG" @@ -130,6 +122,21 @@ main() { # Copy static files static * || exit 2 # Further argument processing --- post-build + postprocess "$@" +} + +preprocess() { + case "${1:-ok}" in + ok) ;; + clean) + log vienna "clean" + rm -r "$OUTD" + exit + ;; + esac +} + +postprocess() { case "${1:-ok}" in ok) ;; publish) -- cgit 1.4.1-21-gabe81