Documentation ¶
Index ¶
Constants ¶
View Source
const ( // GithubComBrainicornSkelpSkelplateSkelplateDescriptor is a json-schema accessor GithubComBrainicornSkelpSkelplateSkelplateDescriptor = `` /* 5785-byte string literal not displayed */ // GithubComBrainicornSkelpSkelplateSelection is a json-schema accessor GithubComBrainicornSkelpSkelplateSelection = `` /* 1426-byte string literal not displayed */ // GithubComBrainicornSkelpSkelplateMultiValue is a json-schema accessor GithubComBrainicornSkelpSkelplateMultiValue = `` /* 1342-byte string literal not displayed */ // GithubComBrainicornSkelpSkelplateSimpleVar is a json-schema accessor GithubComBrainicornSkelpSkelplateSimpleVar = `` /* 633-byte string literal not displayed */ // GithubComBrainicornSkelpSkelplateComplexVar is a json-schema accessor GithubComBrainicornSkelpSkelplateComplexVar = `` /* 1038-byte string literal not displayed */ )
View Source
const (
ErrSkelpFileNotFound = "skelp.json not found: %s"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComplexVar ¶
type ComplexVar struct { SimpleVar // Required whether or not a non-empty value is required. Required bool `json:"required,omitempty"` // Prompt the string to display when asking for a value. Prompt string `json:"prompt,omitempty"` // Min the minimum value (for numbers) or length (for strings). Min float64 `json:"min,omitempty"` // Max the maximum value (for numbers) or length (for strings) Max float64 `json:"max,omitempty"` // Password is a flag to turn on input masking for hiding passwords Password bool `json:"password"` }
ComplexVar applies restrictions to input.
@jsonSchema(additionalProperties=false)
type MultiValue ¶
type MultiValue struct { ComplexVar // IsMultiVal designates the variable as a mutli-value prompt. // // @jsonSchema(required=true) IsMultiVal bool `json:"mutlival"` // AddPrompt is the string to display when asking if another value should be entered. AddPrompt string `json:"addPrompt,omitempty"` }
MultiValue allows the user to enter multiple values. This is for gathering things like "tags"
@jsonSchema(additionalProperties=false)
type Selection ¶
type Selection struct { ComplexVar // MultipleChoice designates whether multiple values may be chosen when the choices field is present. // // @jsonSchema(required=true) MultipleChoice bool `json:"mutlichoice"` // Choices are the options to display in a select box. // @jsonSchema(required=true) Choices []string `json:"choices,omitempty"` }
Selection represents a configurable "select box". The user can choose multiple values or be restricted to choosing a single value.
@jsonSchema(additionalProperties=false)
type SimpleVar ¶
type SimpleVar struct { // Name is the name of the variable. // The name can be a golang template and can use values gathered from previous // variables in the variables array. // // @jsonSchema(required=true) Varname string `json:"name,omitempty"` // Default the default value (can be blank). // // @jsonSchema(required=true, type=["string","number","integer","boolean","array"]) DefaultVal interface{} `json:"default"` }
SimpleVar is an object that can express a name value pair
@jsonSchema(additionalProperties=false)
type SkelplateDataProvider ¶
type SkelplateDataProvider struct {
// contains filtered or unexported fields
}
func NewDataProvider ¶
func NewDataProvider(data map[string]interface{}) *SkelplateDataProvider
func (*SkelplateDataProvider) DataProviderFunc ¶
func (sdp *SkelplateDataProvider) DataProviderFunc(templateRoot string) (interface{}, error)
type SkelplateDescriptor ¶
type SkelplateDescriptor struct { // TemplateAuthor is the author of the template. TemplateAuthor string `json:"author"` // TemplateRepo is the url of the template. TemplateRepo string `json:"repository"` // TemplateDesc is the description of the template. TemplateDesc string `json:"description"` // TemplateCreated is the date the template was created. TemplateCreated time.Time `json:"created"` // TemplateModified is the date the template was last modified. TemplateModified time.Time `json:"modified"` // TemplateVariables holds the variables and their configuration for processing a template. TemplateVariables []TemplateVariable `json:"variables"` }
func (*SkelplateDescriptor) UnmarshalJSON ¶
func (td *SkelplateDescriptor) UnmarshalJSON(data []byte) error
UnmarshalJSON cretaes a template object from a JSON structure
type TemplateVariable ¶
type TemplateVariable interface { Name() string Default() interface{} }
TemplateVariable is the base interface for a variable
@jsonSchema(
anyOf=["github.com/brainicorn/skelp/skelplate/SimpleVar" ,"github.com/brainicorn/skelp/skelplate/ComplexVar" ,"github.com/brainicorn/skelp/skelplate/Selection" ,"github.com/brainicorn/skelp/skelplate/MultiValue"]
)
Click to show internal directories.
Click to hide internal directories.