Documentation
¶
Index ¶
- Constants
- func LanguagesFor(fsys fs.FS, useCase string) ([]string, error)
- func PackageManagersFor(language string) []string
- func Process(fsys fs.FS, srcDir, dstDir string, data Data) error
- func ProcessMultiSource(fsys fs.FS, sel Selection, dstDir string, data Data) error
- func ProcessPostQuickstart(fsys fs.FS, srcDir string, data Data) (string, error)
- func ProcessPostQuickstartMultiSource(fsys fs.FS, sel Selection, data Data) (string, error)
- func UseCases(fsys fs.FS) ([]string, error)
- func Validate(fsys fs.FS, sel Selection) error
- type Data
- type Selection
Constants ¶
const DefaultUseCase = "simple"
DefaultUseCase maps to the template tree root, which released CLI versions already generate from.
Variables ¶
This section is empty.
Functions ¶
func LanguagesFor ¶ added in v0.94.7
LanguagesFor returns the languages the use case supports, in the order of languageOrder. A language is supported when its template tree exists under the use case's root, meaning the language directory itself for go and the shared subdirectory for python and typescript.
func PackageManagersFor ¶ added in v0.94.7
PackageManagersFor returns the package managers the language supports.
func Process ¶
Process reads all files from the specified directory within the provided filesystem, executes them as text/templates with the provided data, and writes the results to the destination directory, preserving the directory structure. Files named POST_QUICKSTART.md are skipped and not copied to the destination.
func ProcessMultiSource ¶ added in v0.75.2
ProcessMultiSource processes templates from multiple source directories (shared + package-manager-specific). It first processes files from the shared directory, then overlays package-manager-specific files. The selection's use case picks the template root. The default use case reads from templates/; any other use case reads from templates/use-cases/USE_CASE/. Under that root, languages that support multiple package managers (python, typescript) expect:
- shared directory: ROOT/LANG/shared/
- package manager directory: ROOT/LANG/PACKAGE_MANAGER/
For languages with a single package manager (go), it falls back to the language root directory.
func ProcessPostQuickstart ¶
ProcessPostQuickstart reads and processes the POST_QUICKSTART.md file from the template directory. Returns the processed content as a string, or empty string if the file doesn't exist.
func ProcessPostQuickstartMultiSource ¶ added in v0.75.2
ProcessPostQuickstartMultiSource reads and processes the POST_QUICKSTART.md file from the package-manager-specific directory. The selection's use case picks the template root, as in ProcessMultiSource. For languages with multiple package managers, it looks in ROOT/LANG/PACKAGE_MANAGER/. For Go, it looks in the ROOT/go/ directory. Returns the processed content as a string, or empty string if the file doesn't exist.