Help us shape the future of Go! Take the 2026 Go Developer Survey

templates

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendFileStep

type AppendFileStep struct {
	Filename string
	Content  string
}

func (*AppendFileStep) Run

func (s *AppendFileStep) Run(ctx TemplateContext) error

type Bundle

type Bundle struct {
	Enabled bool     `yaml:"enabled"`
	Ignore  []string `yaml:"ignore"`
}

type CommandStep

type CommandStep struct {
	Command string   `yaml:"command"`
	Args    []string `yaml:"args"`
}

func (*CommandStep) Run

func (s *CommandStep) Run(ctx TemplateContext) error

type CopyDirAction

type CopyDirAction struct {
	From string
	To   string
}

func (*CopyDirAction) Run

func (s *CopyDirAction) Run(ctx TemplateContext) error

type CopyFileAction

type CopyFileAction struct {
	From string
	To   string
}

func (*CopyFileAction) Run

func (s *CopyFileAction) Run(ctx TemplateContext) error

type CreateFileAction

type CreateFileAction struct {
	Filename string
	Content  string
	Template string
	From     string
}

func (*CreateFileAction) Run

type DeleteFileActionStep

type DeleteFileActionStep struct {
	Files []string `yaml:"files"`
}

func (*DeleteFileActionStep) Run

type Deployment

type Deployment struct {
	Resources Resources `yaml:"resources"`
	Command   string    `yaml:"command"`
	Args      []string  `yaml:"args"`
}

type InitialAgent

type InitialAgent struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

type ModifyPackageJsonStep

type ModifyPackageJsonStep struct {
	Script      []nameValue
	Main        string
	Type        string
	Name        string
	Version     string
	Description string
	Keywords    []string
}

func (*ModifyPackageJsonStep) Run

type ModifyTsConfigStep

type ModifyTsConfigStep struct {
	Types           []string
	CompilerOptions []nameValue
}

func (*ModifyTsConfigStep) Run

type NewAgentSteps

type NewAgentSteps struct {
	Steps []any `yaml:"steps"`
}

type NewProjectSteps

type NewProjectSteps struct {
	InitialAgent InitialAgent `yaml:"initial"`
	Steps        []any        `yaml:"steps"`
}

type Requirement

type Requirement struct {
	Command    string   `yaml:"command"`
	Args       []string `yaml:"args"`
	Version    string   `yaml:"version"`
	Brew       string   `yaml:"brew"`
	URL        string   `yaml:"url"`
	Selfupdate *struct {
		Command string   `yaml:"command"`
		Args    []string `yaml:"args"`
	} `yaml:"selfupdate"`
}

func (*Requirement) Matches

func (r *Requirement) Matches(ctx TemplateContext) bool

func (*Requirement) TryInstall

func (r *Requirement) TryInstall(ctx TemplateContext) error

type Resources

type Resources struct {
	Memory string `yaml:"memory"`
	CPU    string `yaml:"cpu"`
}

type Step

type Step interface {
	Run(ctx TemplateContext) error
}

type Template

type Template struct {
	Name         string        `yaml:"name"`
	Description  string        `yaml:"description"`
	Identifier   string        `yaml:"identifier"`
	Requirements []Requirement `yaml:"requirements"`
}

func (*Template) Install

func (t *Template) Install(ctx TemplateContext) error

Install installs the requirements for the template

func (*Template) Matches

func (t *Template) Matches(ctx TemplateContext) bool

Matches returns true if the template matches the requirements

func (*Template) NewProject

func (t *Template) NewProject(ctx TemplateContext) (*TemplateRules, error)

type TemplateContext

type TemplateContext struct {
	Context     context.Context
	Logger      logger.Logger
	Name        string
	Description string
	ProjectDir  string
	Template    *Template
}

func (*TemplateContext) Interpolate

func (t *TemplateContext) Interpolate(val any) any

type TemplateRules

type TemplateRules struct {
	Identifier      string          `yaml:"identifier"`
	Runtime         string          `yaml:"runtime"`
	Language        string          `yaml:"language"`
	Framework       string          `yaml:"framework"`
	SrcDir          string          `yaml:"src_dir"`
	Filename        string          `yaml:"filename"`
	Bundle          Bundle          `yaml:"bundle"`
	Deployment      Deployment      `yaml:"deployment"`
	NewProjectSteps NewProjectSteps `yaml:"new_project"`
	NewAgentSteps   NewAgentSteps   `yaml:"new_agent"`
}

func LoadTemplateRuleForIdentifier

func LoadTemplateRuleForIdentifier(identifier string) (*TemplateRules, error)

func (*TemplateRules) NewAgent

func (t *TemplateRules) NewAgent(ctx TemplateContext) error

func (*TemplateRules) NewProject

func (t *TemplateRules) NewProject(ctx TemplateContext) error

type Templates

type Templates []Template

func LoadTemplates

func LoadTemplates() (Templates, error)

LoadTemplates returns all the templates available

Jump to

Keyboard shortcuts

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