Documentation
¶
Overview ¶
Package exec allows for a CLI tool to be executed in different contexts
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetWorkdirAsLinuxPath ¶
GetWorkdirAsLinuxPath is useful for consistently mapping any host fs to what is typically in container environments (Linux)
func ToLinuxPath ¶
ToLinuxPath ensures windows paths can be mapped to linux container paths
func WillDocker ¶
func WillDocker() error
WillDocker checks whether Docker is available on the host (via the socket).
func WillPodman ¶
WillPodman checks whether Podman is available and responsive on the host.
Types ¶
type Executor ¶
type Executor interface {
Setup(ctx context.Context, i Instance) error
Exec(filepath string, stdout io.Writer, stderr io.Writer) error
Cleanup(ctx context.Context) error
}
Executor abstracts how a CLI tool is executed (host, Docker, Podman, etc.). Implementations should prepare resources in Setup, execute the tool in Exec, and free resources in Cleanup.
type Instance ¶
type Instance struct {
Bin string `json:"bin" yaml:"bin" jsonschema:"the binary or command to use"`
Start Par `json:"start,flow,omitzero" yaml:"start,flow" jsonschema:"parameters that will be put in front of the file path"`
End Par `json:"end,flow,omitzero" yaml:"end,flow" jsonschema:"parameters that will be put behind the file path"`
ChDir bool `json:"chdir,omitzero" yaml:"chdir" jsonschema:"if true the tool will change directory to where the target file is located"`
WillWrite bool `` /* 175-byte string literal not displayed */
}
Instance describes a single CLI execution configuration for a linter tool. It specifies the binary to run, positional arguments to prepend/append, and whether execution should change to the file's directory first.