From 4967ab1b7223b8deb9c856dfaa65d2d19e6c3aaa Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Fri, 17 Jan 2025 10:09:59 +0100 Subject: [PATCH] Add a YAML extraction script This is intended for use with pkg/embeddedyamls/yamls.go from the operator. Signed-off-by: Stephen Kitt --- extract-yamls | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 extract-yamls diff --git a/extract-yamls b/extract-yamls new file mode 100755 index 0000000..2da50e7 --- /dev/null +++ b/extract-yamls @@ -0,0 +1,18 @@ +#!/usr/bin/awk -f + +# Start of a file entry +/= `/ { + outfile = gensub("_yaml$", ".yaml", "1", $1) + print "Writing " outfile + print substr($0, index($0, "`") + 1) > outfile + next +} + +/^`$/ { + outfile = "" + next +} + +outfile != "" { + print >> outfile +}