Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultManifestName = "MANIFEST.yaml"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TemplateCtx ¶
type TemplateCtx struct { // AppPath is a path to application directory. Application template will be // instantiated in this directory. AppPath string // TargetAppPath is a path directory where an application to be moved to // after instantiation. TargetAppPath string // Manifest is a loaded template manifest. Manifest TemplateManifest // IsManifestPresent is true is a template manifest is loaded. False - otherwise. IsManifestPresent bool // Vars is a map if variables to be used for template rendering. Vars map[string]string // Engine is a template engine to use for template rendering. Engine templates.TemplateEngine }
TemplateCtx contains an information required for application template rendering.
func NewTemplateContext ¶
func NewTemplateContext() TemplateCtx
NewTemplateContext creates new application template context.
type TemplateManifest ¶
type TemplateManifest struct { // Description is a template description. Description string // Vars is a set of variables, which values are to be // requested from a user. Vars []UserPrompt // PreHook is a path to the executable to run before template instantiation. // Application path is passed as a first parameter. PreHook string `mapstructure:"pre-hook"` // PostHook is a path to the executable to run after template instantiation. // Application path is passed as a first parameter. PostHook string `mapstructure:"post-hook"` // Include contains a list of files to keep after template instantiation. Include []string // FollowUpMessage is a message to print to console after application creation. FollowUpMessage string `mapstructure:"follow-up-message"` }
TemplateManifest is a manifest for application template.
func LoadManifest ¶
func LoadManifest(manifestPath string) (TemplateManifest, error)
LoadManifest loads template manifest from manifestPath.
type UserPrompt ¶
type UserPrompt struct { // Prompt is an input prompt for the variable. Prompt string // Name is a variable name to store a value to. Name string // Default is a default value. Default string // Re is a regular expression for the value validation. Re string }
UserPrompt describes interactive prompt to get the value of variable from a user.
Click to show internal directories.
Click to hide internal directories.