diff options
author | Case Duckworth | 2022-10-04 22:47:49 -0500 |
---|---|---|
committer | Case Duckworth | 2022-10-04 22:48:13 -0500 |
commit | 1e539fbe467c359c364a3cdfdc5b27f666a562b1 (patch) | |
tree | 597a98995556817e61eb399d414019e12e83407f | |
parent | add -q and better logic for -c (diff) | |
download | vienna-1e539fbe467c359c364a3cdfdc5b27f666a562b1.tar.gz vienna-1e539fbe467c359c364a3cdfdc5b27f666a562b1.zip |
refactor pre- and post-processing
-rwxr-xr-x | vienna | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/vienna b/vienna index 0ae7027..90e5c03 100755 --- a/vienna +++ b/vienna | |||
@@ -91,17 +91,9 @@ main() { | |||
91 | configure "$@" | 91 | configure "$@" |
92 | shift "$((OPTIND - 1))" | 92 | shift "$((OPTIND - 1))" |
93 | # Further argument processing --- pre-build | 93 | # Further argument processing --- pre-build |
94 | case "${1:-ok}" in | 94 | preprocess "$@" |
95 | ok) ;; | ||
96 | clean) | ||
97 | log vienna "clean" | ||
98 | rm -r "$OUTD" | ||
99 | exit | ||
100 | ;; | ||
101 | esac | ||
102 | # Prepare | 95 | # Prepare |
103 | cd "$WORKD" || exit 2 | 96 | cd "$WORKD" || exit 2 |
104 | test -f "$CONFIG" && . "$CONFIG" # Source ./.vienna.sh, if it exists. | ||
105 | if test -f "$CONFIG"; then | 97 | if test -f "$CONFIG"; then |
106 | # Source ./.vienna.sh, if it exists. | 98 | # Source ./.vienna.sh, if it exists. |
107 | . "$CONFIG" | 99 | . "$CONFIG" |
@@ -130,6 +122,21 @@ main() { | |||
130 | # Copy static files | 122 | # Copy static files |
131 | static * || exit 2 | 123 | static * || exit 2 |
132 | # Further argument processing --- post-build | 124 | # Further argument processing --- post-build |
125 | postprocess "$@" | ||
126 | } | ||
127 | |||
128 | preprocess() { | ||
129 | case "${1:-ok}" in | ||
130 | ok) ;; | ||
131 | clean) | ||
132 | log vienna "clean" | ||
133 | rm -r "$OUTD" | ||
134 | exit | ||
135 | ;; | ||
136 | esac | ||
137 | } | ||
138 | |||
139 | postprocess() { | ||
133 | case "${1:-ok}" in | 140 | case "${1:-ok}" in |
134 | ok) ;; | 141 | ok) ;; |
135 | publish) | 142 | publish) |