dependency

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Git = Dependency{
		Name:       "Git",
		CmdFactory: func() *exec.Cmd { return exec.Command("git", "--version") },
		Help: `Git is required to clone the starter-game-template.
Learn how to install Git: https://github.com/git-guides/install-git`,
	}
	Go = Dependency{
		Name:       "Go",
		CmdFactory: func() *exec.Cmd { return exec.Command("go", "version") },
		Help: `Go is required to build and run World Engine game shards.
Learn how to install Go: https://go.dev/doc/install`,
	}
	Docker = Dependency{
		Name:       "Docker",
		CmdFactory: func() *exec.Cmd { return exec.Command("docker", "--version") },
		Help: `Docker is required to build and run World Engine game shards.
Learn how to install Docker: https://docs.docker.com/engine/install/`,
	}
	DockerDaemon = Dependency{
		Name:       "Docker daemon is running",
		CmdFactory: func() *exec.Cmd { return exec.Command("docker", "info") },
		Help: `Docker daemon needs to be running.
If you use Docker Desktop, make sure that you have ran it`,
	}
	AlwaysFail = Dependency{
		Name:       "Always fails",
		CmdFactory: func() *exec.Cmd { return exec.Command("false") },
		Help:       `This dependency check will always fail. It can be used for testing.`,
	}
)

Functions

func Check

func Check(deps ...Dependency) error

func CheckCmd

func CheckCmd(deps ...Dependency) tea.Cmd

CheckCmd returns a Tea command that checks the given dependencies.

func FormatMissing

func FormatMissing(statuses []Status) string

FormatMissing returns a formatted block for displaying missing dependencies.

func FormatStatuses

func FormatStatuses(statuses []Status) (string, string)

FormatStatuses returns a formatted status list and help text for missing deps.

Types

type CheckResult

type CheckResult struct {
	Statuses []Status
	Err      error
}

CheckResult is the Tea message returned after checking dependencies.

type CmdFactory

type CmdFactory func() *exec.Cmd

CmdFactory creates a new exec.Cmd for each check. This is necessary because exec.Cmd can only be Run() once.

type Dependency

type Dependency struct {
	Name       string
	CmdFactory CmdFactory
	Help       string
}

func (Dependency) Check

func (d Dependency) Check() error

type Status

type Status struct {
	Dependency

	Installed bool
}

Status wraps a Dependency with its check result.

Jump to

Keyboard shortcuts

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