Documentation ¶
Index ¶
- func CreateDirectoryIfNotExists(path string) error
- func WriteStringToFileAndCreateDir(dst string, content string, overwrite bool) error
- type ErrFileExists
- type LineMeta
- type NavColorMeta
- type Tmpl
- func (tmpl *Tmpl) Ensure(file string) error
- func (tmpl *Tmpl) EnsureFiles() error
- func (tmpl *Tmpl) Execute(file string, dataFlattenMap map[string]interface{}) error
- func (tmpl *Tmpl) ExecuteFiles() error
- func (tmpl *Tmpl) ExtractKeys() (string, error)
- func (tmpl *Tmpl) FillDestPath(trimPrefixForDestPath string)
- func (tmpl *Tmpl) Keys(file string, dataFlattenMap map[string]interface{}) error
- func (tmpl *Tmpl) WriteDataObject(dataOut string)
- func (tmpl *Tmpl) WriteProcessedTmpl() error
- type TmplFileMeta
- type TmplOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDirectoryIfNotExists ¶
CreateDirectoryIfNotExists creates a directory only if it doesn't already exist.
Types ¶
type ErrFileExists ¶
type ErrFileExists struct {
// contains filtered or unexported fields
}
ErrFileExists contains error message
func NewErrFileExists ¶
func NewErrFileExists(message string) *ErrFileExists
NewErrFileExists creates the ErrFileExists
type NavColorMeta ¶
type NavColorMeta struct {}
NavColorMeta holds metadata for git style color
func InitializedNavColorMeta ¶
func InitializedNavColorMeta() *NavColorMeta
InitializedNavColorMeta return NavColorMeta that it has been initialized once
type Tmpl ¶
type Tmpl struct { Re *regexp.Regexp TmplOpts *TmplOpts Data map[string]interface{} Files []*TmplFileMeta }
Tmpl contains metadata
func (*Tmpl) EnsureFiles ¶
EnsureFiles check for missing keys in the template files
func (*Tmpl) ExecuteFiles ¶
ExecuteFiles executes template files with datafile and writes the filled data to the file if the file is specified
func (*Tmpl) ExtractKeys ¶
ExtractKeys get all missing keys and processed key:value pairs with given format (by default, yaml)
func (*Tmpl) FillDestPath ¶
FillDestPath fill in the values for destination path
func (*Tmpl) WriteDataObject ¶
WriteDataObject writes the filled data to the output
func (*Tmpl) WriteProcessedTmpl ¶
WriteProcessedTmpl writes processed template
type TmplFileMeta ¶
type TmplFileMeta struct { Name string OrigPath string DestPath string Mode os.FileMode Content string Changed bool }
TmplFileMeta holds information about template file
type TmplOpts ¶
type TmplOpts struct { DataFilesStr string DataFiles []string DataFormat string TmplFiles []string Output string OutDir string OutExt string MissingKey string Interactive bool UseEnv bool UseEnvFromPrefix string DataOutFile string DataOutFormat string FoldContext bool ShowProcessedFile bool ShowOnlyMissingKey bool Overwrite bool }
TmplOpts holds options to execute template
func (*TmplOpts) OptsToTmpl ¶
OptsToTmpl creates a Tmpl object from TmplOpts