Documentation
¶
Index ¶
- Variables
- func Run(ctx context.Context, workDir string, envVars []string, logger *slog.Logger, ...) (out []byte, err error)
- func RunTemplFmt(ctx context.Context, workDir string, path string) error
- func RunTemplWatch(ctx context.Context, workDir string, logger *slog.Logger, ...) error
- func Sh(ctx context.Context, workDir string, logger *slog.Logger, sh string) (out []byte, err error)
- type TemplChange
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExitCode1 = errors.New("exit code 1")
Functions ¶
func Run ¶
func Run( ctx context.Context, workDir string, envVars []string, logger *slog.Logger, cmd string, args ...string, ) (out []byte, err error)
Run runs an arbitrary command and returns (output, ErrExitCode1) if it exits with error code 1, otherwise returns the original error.
func RunTemplFmt ¶ added in v0.8.0
RunTemplFmt runs `templ fmt <path>`.
func RunTemplWatch ¶
func RunTemplWatch( ctx context.Context, workDir string, logger *slog.Logger, st *statetrack.Tracker, templChange chan<- TemplChange, ) error
RunTemplWatch starts `templ generate --log-level debug --watch` and reads its stdout pipe for failure and success logs updating the state accordingly. When ctx is canceled the interrupt signal is sent to the watch process and graceful shutdown is awaited.
Types ¶
type TemplChange ¶ added in v0.10.21
type TemplChange int8
const ( TemplChangeNeedsRestart TemplChange TemplChangeNeedsBrowserReload )
Click to show internal directories.
Click to hide internal directories.