tmpl

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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.

func GetLocalPath

func GetLocalPath() string

GetLocalPath returns the path of the local 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 Make

func Make(expandDir dir.Directory, template string) Template

Make initializes a Template given a dir and the template name or remote.

func (Template) CheckIfCoreRemote

func (temp Template) CheckIfCoreRemote() bool

CheckIfCoreRemote checks if the remote provided is a Lavra repository remote.

func (Template) CheckIfGithubRemote

func (temp Template) CheckIfGithubRemote() bool

CheckIfGithubRemote checks if the remoote provided is a Github repository remote.

func (Template) EnsureTemplateIsFetched

func (temp Template) EnsureTemplateIsFetched() (bool, error)

EnsureTemplateIsFetched fetches the remote template, ensuring that the fetched version is the latest.

func (Template) GetLocalPathByRemote

func (temp Template) GetLocalPathByRemote() string

GetLocalPathByRemote returns the local path of the remote provided.

func (Template) GetSafeRemote

func (temp Template) GetSafeRemote() string

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

func (temp Template) IsTemplateAvailableLocally() bool

IsTemplateAvailableLocally checks whether or not a local template exists by the specific name.

func (Template) IsTemplateAvailableRemotely

func (temp Template) IsTemplateAvailableRemotely(remote string) bool

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.

Jump to

Keyboard shortcuts

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