Documentation
¶
Index ¶
- type AppOptions
- type InventoryData
- type InventoryOptions
- func (i *InventoryOptions) GetFilesystem() (afero.Fs, error)
- func (i *InventoryOptions) GetInventoryFile() string
- func (i *InventoryOptions) GetNamespace() string
- func (i *InventoryOptions) GetRoot() string
- func (i *InventoryOptions) GetSource() string
- func (i *InventoryOptions) GetTemplateDefinitions() ([]TemplateOptions, error)
- func (i *InventoryOptions) GetType() InventorySourceType
- type InventorySourceType
- type OtherOptions
- type TemplateOptions
- func (t *TemplateOptions) GetFilesystem() (afero.Fs, error)
- func (t *TemplateOptions) GetManifestFile() string
- func (t *TemplateOptions) GetName() string
- func (t *TemplateOptions) GetProjectRoot() string
- func (t *TemplateOptions) GetSource() string
- func (t *TemplateOptions) GetType() TemplateSourceType
- func (t *TemplateOptions) IsFileExcluded(curFile string) bool
- type TemplateSourceType
- type ThemeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppOptions ¶
type AppOptions struct {
// Templates 0 or more sources where template projects are to be found
Templates []TemplateOptions `mapstructure:"templates"`
// Inventories 0 or more inventories where groups of templates may be defined
Inventories []InventoryOptions `mapstructure:"inventories"`
// Other miscellaneous config options for the app
Other OtherOptions `mapstructure:"options"`
}
AppOptions parsed config options supported by the app
func FromViper ¶
func FromViper(v *viper.Viper) (AppOptions, error)
FromViper constructs a new set of application options from a Viper config file
func (AppOptions) FindInventory ¶
func (a AppOptions) FindInventory(namespace string) *InventoryOptions
FindInventory locates a template inventory given the namespace name
func (AppOptions) Validate ¶
func (a AppOptions) Validate() error
Validate checks the contents of the parsed application options to make sure they meet the requirements for the application
type InventoryData ¶
type InventoryData struct {
// Templates list of templates defined in the inventory
Templates []TemplateOptions `yaml:"templates"`
}
InventoryData stores data parsed from a template inventory definition file
type InventoryOptions ¶
type InventoryOptions struct {
// Type identifier describing the protocol to use when retrieving template inventories
Type InventorySourceType
// Source path or URL to the inventory
Source string
// Namespace prefix to add to all templates contained in this inventory
Namespace string
}
InventoryOptions configuration parameters for an inventory
func (*InventoryOptions) GetFilesystem ¶
func (i *InventoryOptions) GetFilesystem() (afero.Fs, error)
GetFilesystem loads an appropriate virtual file system to allow reading of the inventory data based on the source type, in a filesystem agnostic way
func (*InventoryOptions) GetInventoryFile ¶
func (i *InventoryOptions) GetInventoryFile() string
GetInventoryFile gets the path, relative to the filesystem root, where the inventory definition file is found
func (*InventoryOptions) GetNamespace ¶
func (i *InventoryOptions) GetNamespace() string
GetNamespace friendly name associated with the namespace. Used when referring to templates in this inventory from the command line
func (*InventoryOptions) GetRoot ¶
func (i *InventoryOptions) GetRoot() string
GetRoot gets the path to the root folder of the virtual file system associated with this template
func (*InventoryOptions) GetSource ¶
func (i *InventoryOptions) GetSource() string
GetSource Path or URL where the source inventory can be found
func (*InventoryOptions) GetTemplateDefinitions ¶
func (i *InventoryOptions) GetTemplateDefinitions() ([]TemplateOptions, error)
GetTemplateDefinitions gets a list of all templates defined in this inventory
func (*InventoryOptions) GetType ¶
func (i *InventoryOptions) GetType() InventorySourceType
GetType identifier describing the protocol to use when retrieving inventory content
type InventorySourceType ¶
type InventorySourceType int64
InventorySourceType enum for all supported source locations for template inventories
const ( // IstUndefined No inventory type defined IstUndefined InventorySourceType = iota // IstUnknown Inventory type provided but not currently supported IstUnknown // IstLocal Inventory source is stored on the local file system IstLocal // IstGit Inventory source is stored in a Git repository IstGit )
type OtherOptions ¶
type OtherOptions struct {
// Theme color scheme to use when presenting colored output
Theme ThemeType
}
type TemplateOptions ¶
type TemplateOptions struct {
// Type identifier describing the protocol to use when retrieving template content
Type TemplateSourceType
// Source Path or URL where the source template can be found
Source string `yaml:"source"` // TODO: make this member private
// Name friendly name associated with the template. Used when referring to the template
// from the command line
Name string `yaml:"name"`
// SubDir optional sub-directory under the template Source location where the template
// definition is found. If not provided, the template is expected to exist in the root
// folder of the Source location
SubDir string `yaml:"subdir"`
// Exclusions set of 0 or more regular expressions defining files to be excluded from
// template processing
Exclusions []string `yaml:"exclusions"`
// contains filtered or unexported fields
}
TemplateOptions metadata describing the source location for a source template
func (*TemplateOptions) GetFilesystem ¶
func (t *TemplateOptions) GetFilesystem() (afero.Fs, error)
GetFilesystem Gets a virtual filesystem pre-loaded to point to the file system for the template
func (*TemplateOptions) GetManifestFile ¶
func (t *TemplateOptions) GetManifestFile() string
GetManifestFile gets the path, relative to the filesystem root, where the template manifest file for this template is found
func (*TemplateOptions) GetName ¶
func (t *TemplateOptions) GetName() string
GetName friendly name associated with the template. Used when referring to the template from the command line
func (*TemplateOptions) GetProjectRoot ¶
func (t *TemplateOptions) GetProjectRoot() string
GetProjectRoot gets the path to the root folder of the virtual file system associated with this template
func (*TemplateOptions) GetSource ¶
func (t *TemplateOptions) GetSource() string
GetSource gets the path to the source folder where the template definition lives
func (*TemplateOptions) GetType ¶
func (t *TemplateOptions) GetType() TemplateSourceType
GetType identifier describing the protocol to use when retrieving template content
func (*TemplateOptions) IsFileExcluded ¶
func (t *TemplateOptions) IsFileExcluded(curFile string) bool
IsFileExcluded returns true if the given file path should be excluded based on the exclusion rules provided by the template options, false if not
type TemplateSourceType ¶
type TemplateSourceType int64
TemplateSourceType enum for all supported source locations for loading templates
const ( // TstUndefined No template type defined in template config TstUndefined TemplateSourceType = iota // TstUnknown Template type provided but not currently supported TstUnknown // TstLocal Template source is stored on the local file system TstLocal // TstGit Template source is stored in a Git repository TstGit )
func (*TemplateSourceType) UnmarshalYAML ¶
func (t *TemplateSourceType) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML decodes values for our enumeration from YAML content
type ThemeType ¶
type ThemeType int64
ThemeType identifier for the various color themes supported by the app
func (*ThemeType) FromString ¶
FromString populates our enumeration from an arbitrary character string