mdtmpl

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Preview     bool   `help:"Enables preview mode. Displays all commands encountered."`
	Write       bool   `help:"Write file instead of printing to standard out"`
	WorkingDir  string `opts:"short=d,help=Specify the working directory for all commands (defaults to each file's dirname)"`
	SkipPadCode bool   `help:"Does not include a space between the triple slash and the code word"`
	ExistOnErr  bool   `help:"Exist on first error without writing contents to the file or stdout"`
}

func (*Config) Commands

func (config *Config) Commands(md []byte) []string

Commands returns the command strings, and does NOT execute them.

func (*Config) Execute

func (config *Config) Execute(md []byte) []byte

Execute the all commands found in the given file and store the result in between the comment tags:

<!--tmpl: my-command -->
some output of my-command goes here
<!--/tmpl-->

It does not return an error. Both successful and failing commands will return their output.

func (*Config) ExecuteIn

func (config *Config) ExecuteIn(md []byte, workingDir string) []byte

ExecuteIn performs an Execute in the specified working directory.

func (*Config) ProcessFile

func (config *Config) ProcessFile(file string, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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