Documentation ¶
Overview ¶
Package tools has been designed to run different tools either directly or though Docker.
Index ¶
- type Busted
- type Controller
- type Docker
- type Dockerized
- type FileState
- type Format
- type FormatFile
- type Krane
- type Ktech
- type Ktools
- type LDoc
- type Lint
- type LintFile
- type LintFileIssue
- type Luacheck
- type Prettier
- type StyLua
- type Tool
- func (t *Tool) DockerImage() string
- func (t *Tool) ExecCommand(arg ...string) *exec.Cmd
- func (t *Tool) ExistsInDocker() bool
- func (t *Tool) ExistsOnSystem() bool
- func (t *Tool) IsDockerImageAvailable() bool
- func (t *Tool) LookPath() (string, error)
- func (t *Tool) Name() string
- func (t *Tool) Path() string
- func (t *Tool) PullDockerImage() bool
- func (t *Tool) SetDockerImage(image string)
- func (t *Tool) SetDockerized(dockerized *Dockerized) error
- func (t *Tool) SetIgnore(ignore []string)
- func (t *Tool) SetRunInDocker(runInDocker bool)
- func (t *Tool) Version() string
- type Tooler
- type Tools
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Busted ¶
type Busted struct {
Tool
}
Busted represents a Busted tool.
func (*Busted) LoadVersion ¶
LoadVersion loads a Busted version.
type Controller ¶
type Controller interface { SetToolsRunInDocker(bool) LookPaths() LoadVersions() }
Controller is the interface that wraps the Tools methods.
type Docker ¶
type Docker struct {
Tool
}
Docker represents a Docker tool.
func (*Docker) LoadVersion ¶
LoadVersion loads a Docker version.
type Dockerized ¶
type Dockerized struct { // Image hold the image name and tag. // // Default: dstmodders/dst-mod:latest Image string // Remove sets whether a container should be removed right after running. // // Default: true Remove bool // User holds a username or UID to run a container as. // // Default: dst-mod User string // Volume holds a volume to mount. By default, points to a working directory. Volume string // contains filtered or unexported fields }
Dockerized represents a Docker arguments to run a tool.
func NewDockerized ¶
func NewDockerized() *Dockerized
NewDockerized creates a new Dockerized instance.
func (*Dockerized) Args ¶
func (d *Dockerized) Args() []string
Args returns arguments prepared using PrepareArgs.
func (*Dockerized) IsImageAvailable ¶
func (d *Dockerized) IsImageAvailable() bool
IsImageAvailable checks whether an image is available locally.
func (*Dockerized) PrepareArgs ¶
func (d *Dockerized) PrepareArgs() (result []string, err error)
PrepareArgs prepare arguments to return later using Args.
type FileState ¶
type FileState int
FileState represents a single linting or formatting file result state.
type FormatFile ¶
type FormatFile struct { // Path holds a file path. Path string // State holds a file state. State FileState }
FormatFile represents a single formatting file.
type Ktools ¶
type Ktools struct {
Tool
}
Ktools represents a Ktools tool.
func (*Ktools) LoadVersion ¶
LoadVersion loads a Ktools version.
type LDoc ¶
type LDoc struct {
Tool
}
LDoc represents an LDoc tool.
func (*LDoc) LoadVersion ¶
LoadVersion loads an LDoc version.
type LintFile ¶
type LintFile struct { // Path holds a file path. Path string // State holds a file state. State FileState // Issues holds the found issues. Issues []LintFileIssue }
LintFile represents a single linting file.
type LintFileIssue ¶
type LintFileIssue struct { // Name holds a file name. Name string // StartLine holds the start line number which corresponds to this issue. StartLine int // EndLine holds the end line number which corresponds to this issue. EndLine int // Issue holds the issue description. Description string }
LintFileIssue represents a single issue in a file.
type Luacheck ¶
type Luacheck struct {
Tool
}
Luacheck represents a Luacheck tool.
func NewLuacheck ¶
NewLuacheck creates a new Luacheck instance.
func (*Luacheck) LoadVersion ¶
LoadVersion loads a Luacheck version.
type Prettier ¶
type Prettier struct { Tool // DefaultExt holds default extensions: ".md", ".xml", ".yml". DefaultExt []string // ListDifferent sets whether only different files should be listed. ListDifferent bool }
Prettier represents a Prettier tool.
func NewPrettier ¶
NewPrettier creates a new Prettier instance.
func (*Prettier) LoadVersion ¶
LoadVersion loads a Prettier version.
type StyLua ¶
StyLua represents a StyLua tool.
func (*StyLua) LoadVersion ¶
LoadVersion loads a StyLua version.
type Tool ¶
type Tool struct { // Cmd holds a command. Cmd string // CmdArgs holds a command arguments. CmdArgs []string // contains filtered or unexported fields }
Tool represents a single tool.
func (*Tool) ExecCommand ¶
ExecCommand executes the command with the passed arguments either directly or through a Docker container.
func (*Tool) ExistsInDocker ¶
ExistsInDocker checks if the tool exists inside a Docker container.
func (*Tool) ExistsOnSystem ¶
ExistsOnSystem checks if the tool exists on the system.
func (*Tool) IsDockerImageAvailable ¶
IsDockerImageAvailable checks if the Docker image is available.
func (*Tool) LookPath ¶
LookPath looks for a direct path of the tool which can be retrieved later using Path.
func (*Tool) PullDockerImage ¶
PullDockerImage pull the Docker image.
func (*Tool) SetDockerImage ¶
SetDockerImage sets the Docker image.
func (*Tool) SetDockerized ¶
func (t *Tool) SetDockerized(dockerized *Dockerized) error
SetDockerized sets dockerized.
func (*Tool) SetRunInDocker ¶
SetRunInDocker sets whether a tool should be run in Docker.
type Tooler ¶
type Tooler interface { Name() string Path() string Version() string SetDockerized(*Dockerized) error DockerImage() string SetDockerImage(image string) IsDockerImageAvailable() bool PullDockerImage() bool SetIgnore([]string) SetRunInDocker(bool) ExecCommand(...string) *exec.Cmd LookPath() (string, error) ExistsOnSystem() bool ExistsInDocker() bool LoadVersion() (string, error) // contains filtered or unexported methods }
Tooler is the interface that wraps the Tool methods.
type Tools ¶
type Tools struct { Busted *Busted Docker *Docker Krane *Krane Ktech *Ktech LDoc *LDoc Luacheck *Luacheck Prettier *Prettier StyLua *StyLua // contains filtered or unexported fields }
Tools represents all the supported tools.
func (*Tools) LoadVersions ¶
func (t *Tools) LoadVersions()
LoadVersions loads versions of all tools.
func (*Tools) SetToolsRunInDocker ¶
SetToolsRunInDocker sets all tools to be run in Docker.