Documentation
¶
Overview ¶
Package template fetches a starter tree from a remote source and copies it into a local directory. Used by `txco init --from <source>`.
The convention: a template is a *flat tree* meant to slot directly under `OPS/<stack>/` in the user's workspace. So given:
github:loremlabs/txco-templates/support-basic
where the repo's `support-basic/` directory contains:
support-basic/ 100/resonator.txcl 200/resonator.txcl triage/100/resonator.txcl
running `txco init support --from github:loremlabs/txco-templates/support-basic` produces:
<cwd>/OPS/support/100/resonator.txcl <cwd>/OPS/support/200/resonator.txcl <cwd>/OPS/support/triage/100/resonator.txcl
v1 supports the `github:` scheme only. Public repos only — fetched as a tar.gz from codeload.github.com. No variable substitution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCodeloadBaseURL ¶
SetCodeloadBaseURL lets tests point the GitHub fetcher at an httptest server. Returns the previous value so callers can restore in t.Cleanup.
Types ¶
type Source ¶
type Source interface {
Spec() string
Fetch(ctx context.Context, destDir string) (filesCopied int, err error)
}
Source is anything that knows how to populate destDir with template files. Today there's only one (githubSource); the interface is here so future schemes (gitlab:, file:, etc.) drop in without churning the call sites.