egrunner

command
Version: v0.0.0-...-a7167af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 15 Imported by: 0

README

egrunner

egrunner runs bash scripts in a Docker container to help with creating reproducible examples.

go get -u myitcv.io/cmd/egrunner

Example

The following script:

# We can put whatever we like here. The START delimeter below marks the actual
# start of our script
echo This will not be seen

# **START**

comment "We can use the comment function to output comments.
This is only really useful when running with -out std"
comment
comment "assert when an exit code is something non-zero (else the script will fail)"
comment

# block: assert
false
assert "$? -eq 1" $LINENO

comment
comment "catfile's output is most useful with PrintBlockOut in mdreplace"
comment

# block: catfile
cat <<EOD > a_file.txt
Hello, world
EOD
catfile a_file.txt

# egrunner_envsubst: +repo
# egrunner_replace: "^Good morning, (.*)$" "Hi $1!"

comment
comment 'In this script we have defined the following directives:

egrunner_envsubst: +repo
egrunner_replace: "^Good morning, (.*)$" "Hi $1!"

Hence we get the following:'
comment

# block: directives
export repo=X
echo $repo
echo "Good morning, Rob"

results in:

$ gobin -m -run myitcv.io/cmd/egrunner -uid -gid -out std _examples/Dockerfile _examples/readme.sh
# We can use the comment function to output comments.
# This is only really useful when running with -out std

# assert when an exit code is something non-zero (else the script will fail)

$ false

# catfile's output is most useful with PrintBlockOut in mdreplace

$ cat <<EOD >a_file.txt
Hello, world
EOD
$ catfile a_file.txt
$ cat a_file.txt
Hello, world

# In this script we have defined the following directives:
#
# egrunner_envsubst: +repo
# egrunner_replace: "^Good morning, (.*)$" "Hi $1!"
#
# Hence we get the following:

$ export repo=X
$ echo X
X
$ echo "Good morning, Rob"
Good morning, Rob
=============================================

Documentation

Overview

egrunner runs bash scripts in a Docker container to help with creating reproducible examples.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL