Documentation
¶
Index ¶
Constants ¶
View Source
const (
DEFAULT_SEPARATOR_CHAR rune = ' '
)
View Source
const (
DefaultTemplatePromptFormat string = "*"
)
Variables ¶
View Source
var ( DefaultTemplatePromptCapture types.RegexString = types.RegexString{Regexp: regexp.MustCompile(`\s*(.*?)\s*`)} DefaultTemplatePromptValidate types.RegexString = types.RegexString{Regexp: regexp.MustCompile(`.+`)} )
Functions ¶
This section is empty.
Types ¶
type TemplateIgnore ¶
func (*TemplateIgnore) MarshalJSON ¶ added in v0.9.0
func (t *TemplateIgnore) MarshalJSON() ([]byte, error)
func (*TemplateIgnore) MarshalYAML ¶ added in v0.9.0
func (t *TemplateIgnore) MarshalYAML() ([]byte, error)
func (*TemplateIgnore) UnmarshalJSON ¶ added in v0.9.0
func (t *TemplateIgnore) UnmarshalJSON(data []byte) error
func (*TemplateIgnore) UnmarshalYAML ¶ added in v0.9.0
func (t *TemplateIgnore) UnmarshalYAML(data []byte) error
func (*TemplateIgnore) Validate ¶
func (t *TemplateIgnore) Validate(styleSourceDir string) error
type TemplateInclude ¶ added in v0.9.0
type TemplateInclude struct {
// The files that should be ignored when copying
Ignore *TemplateIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"`
// The templated parent directory path
Directory *types.CleanString `json:"dir,omitempty" yaml:"dir,omitempty"`
// Must be:
// - subdir of the template root
// - not same as styleSourceDir
// - not subdir of styleSourceDir
Source types.CleanString `json:"source" yaml:"source"`
}
Additional directories to include in templating.
This can support []{ source, ignore } and []string
func (TemplateInclude) MarshalJSON ¶ added in v0.9.0
func (t TemplateInclude) MarshalJSON() ([]byte, error)
func (TemplateInclude) MarshalYAML ¶ added in v0.9.0
func (t TemplateInclude) MarshalYAML() ([]byte, error)
func (*TemplateInclude) UnmarshalJSON ¶ added in v0.9.0
func (t *TemplateInclude) UnmarshalJSON(data []byte) error
func (*TemplateInclude) UnmarshalYAML ¶ added in v0.9.0
func (t *TemplateInclude) UnmarshalYAML(data []byte) error
type TemplateIncludes ¶ added in v0.9.0
type TemplateIncludes []TemplateInclude
func (*TemplateIncludes) Validate ¶ added in v0.9.0
func (t *TemplateIncludes) Validate(templateRootDir, styleSourceDir string) error
type TemplateJson ¶
type TemplateJson struct {
Ignore *TemplateIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"` // The files that should be ignored when copying
Labels TemplateLabel `json:"labels,omitempty" yaml:"labels,omitempty"` // The repository labels
Styles TemplateStyles `json:"styles" yaml:"styles"` // The name of the style mapped to the path to the directory
Prompts TemplatePrompts `json:"prompts,omitempty" yaml:"prompts,omitempty"` // The additional prompts to use
}
The config file
func (*TemplateJson) Validate ¶
func (t *TemplateJson) Validate(templateRootDir string) error
type TemplateLabel ¶
type TemplateLabel []struct {
Name types.CleanString `json:"name" yaml:"name"`
Color types.HexColor `json:"color" yaml:"color"`
Desc string `json:"description,omitempty" yaml:"description,omitempty"`
}
type TemplatePrompt ¶
type TemplatePrompt struct {
Format *string `json:"fmt,omitempty" yaml:"fmt,omitempty"`
Separator *string `json:"sep,omitempty" yaml:"sep,omitempty"`
Capture *types.RegexString `json:"capture,omitempty" yaml:"capture,omitempty"`
Validate *types.RegexString `json:"validate,omitempty" yaml:"validate,omitempty"`
Key types.CleanString `json:"key" yaml:"key"`
Ask types.PermissiveString `json:"ask,omitempty" yaml:"ask,omitempty"`
Type TemplateVarType `json:"type" yaml:"type"`
// contains filtered or unexported fields
}
TemplatePrompts are the additional things that are formatted into the template.
They prompt keys are case sensitive and Pacal case is recommended.
func (*TemplatePrompt) FormattedAsk ¶
func (t *TemplatePrompt) FormattedAsk() string
FormattedAsk returns the formatted string for the prompt
func (*TemplatePrompt) Set ¶
func (t *TemplatePrompt) Set(s string) error
Set sets the value provided by the user
func (*TemplatePrompt) UnmarshalJSON ¶
func (t *TemplatePrompt) UnmarshalJSON(data []byte) error
func (*TemplatePrompt) UnmarshalYAML ¶ added in v0.6.0
func (t *TemplatePrompt) UnmarshalYAML(data []byte) error
type TemplatePrompts ¶
type TemplatePrompts []TemplatePrompt
TemplatePrompts are the additional things that are formatted into the template.
type TemplateStyle ¶
type TemplateStyle struct {
Ignore *TemplateIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"` // The files that should be ignored when copying
Source types.CleanString `json:"source" yaml:"source"` // The source template path
Labels TemplateLabel `json:"labels,omitempty" yaml:"labels,omitempty"` // The repository labels
Prompts TemplatePrompts `json:"prompts,omitempty" yaml:"prompts,omitempty"` // The additional prompts to use
Includes TemplateIncludes `json:"includes,omitempty" yaml:"includes,omitempty"` // The additional includes
Variables TemplateVariables `json:"variables,omitempty" yaml:"variables,omitempty"` // The additional variables
}
type TemplateStyles ¶
type TemplateStyles map[types.CleanString]TemplateStyle
func (*TemplateStyles) Validate ¶
func (t *TemplateStyles) Validate(templateRootDir string) error
type TemplateVarType ¶ added in v0.9.2
type TemplateVarType string
The type of the prompt response
const ( TemplateVarTypeString TemplateVarType = "str" TemplateVarTypeArray TemplateVarType = "arr" )
func (*TemplateVarType) UnmarshalJSON ¶ added in v0.9.2
func (t *TemplateVarType) UnmarshalJSON(data []byte) error
func (*TemplateVarType) UnmarshalYAML ¶ added in v0.9.2
func (t *TemplateVarType) UnmarshalYAML(data []byte) error
type TemplateVariable ¶ added in v0.9.3
type TemplateVariable struct {
Separator *string `json:"sep,omitempty" yaml:"sep,omitempty"`
Key types.CleanString `json:"key" yaml:"key"`
Format types.PermissiveString `json:"fmt" yaml:"fmt"`
Type TemplateVarType `json:"type" yaml:"type"`
// contains filtered or unexported fields
}
func (*TemplateVariable) Set ¶ added in v0.9.3
func (t *TemplateVariable) Set(d map[string]any) error
func (*TemplateVariable) UnmarshalJSON ¶ added in v0.9.3
func (t *TemplateVariable) UnmarshalJSON(data []byte) error
func (*TemplateVariable) UnmarshalYAML ¶ added in v0.9.3
func (t *TemplateVariable) UnmarshalYAML(data []byte) error
func (*TemplateVariable) Value ¶ added in v0.9.3
func (t *TemplateVariable) Value() any
type TemplateVariables ¶ added in v0.9.3
type TemplateVariables []TemplateVariable
Click to show internal directories.
Click to hide internal directories.