Documentation
¶
Overview ¶
Package compose assembles dockhand for a command: the engine, with its providers, its GitHub runtime, and the readers it's given, from the person's settings and configuration, in one place. The command line asks it for an engine; a test gives it stand-ins (Dependencies), so no seam is a package variable (X1, the architecture review of 5897a82).
Index ¶
- Constants
- func ParseTool(value string) (name, path string, err error)
- func Settings(ctx context.Context, options Options, dependencies Dependencies) (engine.Options, config.File, string, error)
- type Assembly
- type Dependencies
- type NamedProgram
- type Options
- func (o Options) Getenv(name string) string
- func (o Options) LookPath(name string) string
- func (o Options) NamedPrograms(file config.File, configPath string, look func(string) (string, error)) (map[string]NamedProgram, error)
- func (o Options) Places() config.Places
- func (o Options) Signin(store credential.Store) github.Signin
- func (o Options) SpendLog() string
- func (o Options) TartPlaces() TartPlaces
- func (o Options) TartProvider(look func(string) (string, error)) *tart.Provider
- type TartPlaces
Constants ¶
const PullRequestsVariable = "DOCKHAND_PULL_REQUESTS"
PullRequestsVariable names the sandbox pull requests go to instead of MacPorts' repository (engine.Options.PullRequests).
Variables ¶
This section is empty.
Functions ¶
func ParseTool ¶ added in v0.8.0
ParseTool reads one --tool value, name=path, refusing another shape or a name that isn't a program dockhand runs.
func Settings ¶
func Settings(ctx context.Context, options Options, dependencies Dependencies) (engine.Options, config.File, string, error)
Settings resolves the engine's options from the command line's, the environment, and the configuration file, which it reads, with the programs the engine runs found as dependencies find them (Lookup).
Types ¶
type Assembly ¶
type Assembly struct {
Engine *engine.Engine
File config.File
// Options are the engine's options, as it was opened with them.
Options engine.Options
}
Assembly is what a command works with: the engine, opened, and the configuration it was opened with.
type Dependencies ¶
type Dependencies struct {
Preparer func(*engine.Engine) engine.Preparer
Forge func(*engine.Engine) engine.Forge
// Ports are what the engine reads of ports, MacPorts' own where no
// Reader is given; ArchiveFetcher, given the engine, fetches archives
// in their place.
Ports engine.Ports
ArchiveFetcher func(*engine.Engine) engine.ArchiveFetcher
OutdatedReader engine.OutdatedReader
ProjectReader engine.ProjectReader
HTTPS engine.HTTPSProbe
// Builders stand in for ports.macports.org's build history.
Builders engine.BuilderHistory
GitHubCLI engine.GitHubCLI
// Actions stands in for GitHub Actions, with no waiting between polls.
Actions ghactions.API
// Leftovers is a provider with environments left behind, registered
// under its name in place of whichever the configuration made.
Leftovers buildenv.LeftoverProvider
// Look finds a program by name, each program compose hands down
// found with it once; the command line's PATH where nil (Lookup).
Look func(string) (string, error)
// GitHubClient is GitHub as the login reaches it, with Store's;
// github.SystemClient where nil, over the system keychain where Store
// is nil.
GitHubClient func(github.Signin) *github.Client
Store credential.Store
}
Dependencies stand in for what compose would make: the readers, providers, and clients a test gives, each the real one where it's nil.
func (Dependencies) Lookup ¶ added in v0.8.0
func (d Dependencies) Lookup(options Options) func(string) (string, error)
Lookup is how compose finds a program: Look, or else the command line's PATH (subprocess.LookPath).
func (Dependencies) LookupNamed ¶ added in v0.8.0
func (d Dependencies) LookupNamed(options Options, resolved engine.Options) func(string) (string, error)
LookupNamed is Lookup with the programs Settings resolved as named ahead of it (engine.Options.Named).
type NamedProgram ¶ added in v0.8.0
NamedProgram is a program dockhand runs as the command line, its environment, or the configuration file named it: its path, and what named it, "--tool git", "GIT_BIN", or "[tools] git".
type Options ¶
type Options struct {
Tree, Database string
// Tools are --tool's programs, by name, each its value as given.
Tools map[string]string
// MigrateUnderLive migrates the database though a process on the
// older schema is working, as the person answered.
MigrateUnderLive bool
// MigrateRelease migrates a database a release last opened with a
// build that isn't one, as the person answered.
MigrateRelease bool
// NamesBranch is a command naming a branch, which run outside any
// checkout finds the one the database registered (registeredCheckout).
NamesBranch bool
// Unattended is a command nobody can answer, serve's or one with no
// terminal: git's ssh never asks it (git.Unattended).
Unattended bool
// KeepHTTP is --keep-http, over [update] keep_http
// (engine.Options.KeepHTTP).
KeepHTTP bool
// Source is --source, over [update] source (engine.Options.Source).
Source string
// Env is the command line's environment, as os.Environ gives one, and
// Dir its working directory, which compose reads in place of the
// process's.
Env []string
Dir string
}
Options are the command line's selections, each its flag's value, empty where it wasn't given: its environment variable then stands, then its default.
func (Options) LookPath ¶
LookPath is the executable name finds on the command line's PATH (subprocess.LookPath), or empty.
func (Options) NamedPrograms ¶ added in v0.8.0
func (o Options) NamedPrograms(file config.File, configPath string, look func(string) (string, error)) (map[string]NamedProgram, error)
NamedPrograms are the programs named for this command line, by name, each checked as it's resolved: --tool, then its variable, then [tools] in file (read from configPath, which a refusal names), each refused where it names a program that isn't there, with no fallback to the search (the person's choice, 2026-11-03). look finds a bare name on PATH. A program nothing names isn't among them.
func (Options) Signin ¶
func (o Options) Signin(store credential.Store) github.Signin
Signin is how the command line reaches the person's GitHub login, with the login kept in store: GH_TOKEN's token, else GITHUB_TOKEN's, ahead of it; its renewals' lock beside the configuration, ~/.dockhand/github-login.lock; and the GitHub CLI on the command line's PATH.
func (Options) SpendLog ¶
SpendLog is the file each command appends what it spent of GitHub's allowance to, $DOCKHAND_GITHUB_LOG, or none.
func (Options) TartPlaces ¶
func (o Options) TartPlaces() TartPlaces
TartPlaces are dockhand's Tart home, $DOCKHAND_TART_HOME or ~/.dockhand/tart; the person's, $TART_HOME or ~/.tart; and the SSH keys' folder, $DOCKHAND_SSH_DIR or ~/.dockhand/ssh: each variable's value made absolute against the command line's directory, each default under its home, or empty without one.
type TartPlaces ¶
type TartPlaces struct {
Home, Personal, Keys string
}
TartPlaces are where dockhand's Tart work lives on this Mac: Home, its own Tart home; Personal, the person's, which it only reads; and Keys, the folder of the SSH keys its guests are reached with.