reads the formatted output of a program, and writes it to a file.
before the actual write, the output is passed through some transformers that strip-down and dress-up the text, e.g. get rid of redundant blank lines, or append an auto-generated message to the end of the file.
if you don't want to use the transformers, you can just skip the renderer and redirect your program's output directly to a file, after setting the desired format. for example:
env FORMAT=markdown ./my-command -h > ./usage/my-command.md
( export FORMAT=<format> OUTPUT_PATH=<output_path> ; <my-command> | ./styli.sh/renderer )
./renderer -h
-h
- shows this help message.
environment variables for the renderer must be declared using export
(rather than env
), in order to share them both with the renderer and the formatter in your program.
FORMAT
- which format to use. possible values:
markdown
,terminal
,raw
.
OUTPUT_PATH
- where to write to. value should be a full path, including file name and extension.
assuming ./foo
is a program that source
s the styli.sh formatter, and its output is formatted when using the -h
flag:
-
render a markdown file
( export FORMAT="markdown" OUTPUT_PATH=./usage/foo.md ; ./foo -h | ./styli.sh/renderer )
writes the markdown-formatted output of
./foo -h
to./usage/foo.md
created with styli.sh