Copy the stdout of the container run to stderr, so it's visible during the run
Some podman command output was leaking into the generated output
Add snapshots and -k
Extract codes from a Markdown file, run the code in a container, and replace keywords in the stream with the output from the run.
Why on Earth would you want to do this? It checks for syntax errors in your examples and makes sure they compile and run; and it reduces or eliminates the need to copy, paste, and manually run your code snippets, and copy and paste their outputs back into your document.
USAGE: <README.template ./techdochelper.sh <KEYWORD> > README.md
See the sample.tmpl file in this repository for an example.
Note that each invokation of the OUTPUT will invoke the dependency resolution and the compiler. While this is generally no issue for interpreted languages, or languages with fast compilers, it can be quite slow to (e.g.) update crates.io and compile even small Rust programs. To mitigate this, there's an experimental (~cough~ lightly tested ~cough~) -k
option you can give before the KEYWORD
; this will prevent container images from being cleaned. In the case of Rust, where the crate update
command is part of the PRECMD
, this can drastically speed up subsequent invokations. It has almost no impact on bash or Go programs, unless the go.mod
has some heavy dependencies.
This program is licensed CC BY-CA 4.0
To allow formatted fenced, techdochelper will only grab code blocks that have a file name after the syntax marker. This is used as the output for the code block.
The keyword may be followed by text. Anything after the keyword will be passed, as arguments, to the execution of the program. This allows you to run the program multiple times with different inputs.
The output will be fenced as shell output, including the command line used to run the program.
Arbitrary fencings are supported; anything with a syntaxed fence will be written to the named file. This can be used to set up dependencies in Go or Rust, for example, by fencing a gomod go.mod
or toml Cargo.toml
. In these cases, the syntax name does not matter since no container is run for them.
I'll happily accept any patches for other languages.