heat/tools/rst2script.sed
Zane Bitter 95e5ed0670 Add Getting Started guide to repo
Convert the Getting Started wiki page to ReStructuredText format and add it
to the repository. Also add a script that will extract the shell commands
from the document and run them, so we can use it as an integration test.

The script can be run using the command:
    > bash -c "$(./tools/rst2script.sed docs/GettingStarted.rst)"

Related: #84

Signed-off-by: Zane Bitter <zbitter@redhat.com>
2012-05-11 18:56:12 +02:00

39 lines
567 B
Sed
Executable File

#!/bin/sed -nrf
# Skip over the ".." line that starts a comment block.
/^\.{2}[[:space:]]*$/ n
# Loop through the block until a non-indented line is found.
# Append indented lines to the hold space.
: indent
/^ {4}/ {
s/^ {4}//
H
$ b endblock
n
b indent
}
# Loop through to the end of the block.
# Clear the hold space if unindented lines are present.
:nonindent
/^[[:space:]]*$/! {
x
s/.*//
x
$ d
n
b nonindent
}
# Print the contents of the hold space (if any) and clear it.
: endblock
s/.*//
x
s/^\n//
/./ {
p
a \
}