Documentation
¶
Index ¶
- func GetCachePath() string
- func GetLocalPath() string
- type Template
- func (temp Template) CheckIfCoreRemote() bool
- func (temp Template) CheckIfGithubRemote() bool
- func (temp Template) EnsureTemplateIsFetched() (bool, error)
- func (temp Template) GetLocalPathByRemote() string
- func (temp Template) GetSafeRemote() string
- func (temp Template) IsTemplateAvailableLocally() bool
- func (temp Template) IsTemplateAvailableRemotely(remote string) bool
- func (temp Template) LoadRemoteTemplateIntoMemory() (*git.Repository, error)
- type TemplateManifest
- type TemplateSurvey
- type TemplateSurveyPrompt
- type TemplateSurveyValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCachePath ¶
func GetCachePath() string
GetCachePath returns the path of the local cache of fetched remote templates.
Types ¶
type Template ¶
type Template struct {
From string
Directory dir.Directory
TemplateDirectory dir.Directory
Manifest TemplateManifest
}
Template holds information related to the template being rendered.
func (Template) CheckIfCoreRemote ¶
CheckIfCoreRemote checks if the remote provided is a Lavra repository remote.
func (Template) CheckIfGithubRemote ¶
CheckIfGithubRemote checks if the remoote provided is a Github repository remote.
func (Template) EnsureTemplateIsFetched ¶
EnsureTemplateIsFetched fetches the remote template, ensuring that the fetched version is the latest.
func (Template) GetLocalPathByRemote ¶
GetLocalPathByRemote returns the local path of the remote provided.
func (Template) GetSafeRemote ¶
GetSafeRemote returns a string with the full Git URL for Lavra-owned projects as well Github-hosted projects, and finally the given remote string.
func (Template) IsTemplateAvailableLocally ¶
IsTemplateAvailableLocally checks whether or not a local template exists by the specific name.
func (Template) IsTemplateAvailableRemotely ¶
IsTemplateAvailableRemotely returns a boolean stating whether the the remote template is available.
func (Template) LoadRemoteTemplateIntoMemory ¶
func (temp Template) LoadRemoteTemplateIntoMemory() (*git.Repository, error)
LoadRemoteTemplateIntoMemory loads the remote template into memory for
type TemplateManifest ¶
type TemplateManifest struct {
Name string `yaml:"name"`
Author string `yaml:"author"`
Description string `yaml:"description"`
Survey []TemplateSurvey `yaml:"survey"`
}
TemplateManifest is an instance of the template configuration file.
type TemplateSurvey ¶
type TemplateSurvey struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Prompt TemplateSurveyPrompt `yaml:"prompt"`
Validate TemplateSurveyValidator `yaml:"validate"`
}
TemplateSurvey holds the template survey input.
type TemplateSurveyPrompt ¶
type TemplateSurveyPrompt struct {
Message string `yaml:"message"`
}
TemplateSurveyPrompt holds options available for various input prompt configs.
type TemplateSurveyValidator ¶
type TemplateSurveyValidator struct {
Required bool `yaml:"required"`
}
TemplateSurveyValidator holds options available for validating survey prompts.