cmd/scriggo: implement 'scriggo run' to run a template file
gazerro opened this issue · 0 comments
This proposal want to implement a scriggo subcommand to render a single template file as proposed in discussion #875:
scriggo run [ -o output ] [ -root dir ] [ -const name=value ] [ -format format ] [ -metrics ] [-S n] path
It runs the file with the given path
, relative to the file's directory, and write the resulting code to the standard output. The file format is determined by the file extension.
The -o
flag writes the resulting code to the named output file or directory.
The -root
flag sets the root directory to the named directory instead of the file's directory.
The -const
flag runs the template file with a global constant with the given name and value. name
should be a Go identifier and value
should be a string literal, a number literal, true
or false
. There can be multiple name=value
pairs.
The -format
flag forces render to use the named file format.
The -metrics
flag prints metrics about execution time.
The -S
flag prints the assembly code of the executed file and n
determines the maximum length, in runes, of disassembled Text instructions
n > 0: at most n runes; leading and trailing white space are removed
n == 0: no text
n < 0: all text
Examples:
$ scriggo run index.html
$ scriggo run -const 'version=1.12 title="The ancient art of tea"' index.md
$ scriggo run -root . docs/article.html
$ scriggo run -format Markdown index
$ scriggo run -o ./public ./sources/index.html