summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-10-10 22:39:48 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-10-10 22:39:48 +0200
commitb6e6cb61c6e9692e9706b0f27b2ec735218a0722 (patch)
tree34921e8fec1c6d3ccce0dd0cf90f010b404ec43f /scripts
downloadtheos-website-b6e6cb61c6e9692e9706b0f27b2ec735218a0722.tar.xz
Initial commit
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/awink28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/awink b/scripts/awink
new file mode 100755
index 0000000..1456c8b
--- /dev/null
+++ b/scripts/awink
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+##
+# arguments:
+# $1 In file
+# $2 Out file
+build() {
+ gawk '{
+ if (NF == 2 && $1 == "%include") {
+ while ((getline line < $2) > 0) {
+ print line;
+ }
+ close($2);
+ } else {
+ print;
+ }
+ }' "$1" > "$2"
+}
+
+main() {
+ if [[ "$#" != 2 ]]; then
+ printf "%s\n" "awink <in file> <out file>"
+ exit 2
+ fi
+
+ build "$1" "$2"
+}
+main "$@"