import "github.com/euforic/templit"DefaultFuncMap is the default function map for templates.
var DefaultFuncMap = template.FuncMap{
    "lower":        strings.ToLower,
    "upper":        strings.ToUpper,
    "trim":         strings.TrimSpace,
    "split":        strings.Split,
    "join":         strings.Join,
    "replace":      strings.ReplaceAll,
    "contains":     strings.Contains,
    "hasPrefix":    strings.HasPrefix,
    "hasSuffix":    strings.HasSuffix,
    "trimPrefix":   strings.TrimPrefix,
    "trimSuffix":   strings.TrimSuffix,
    "trimSpace":    strings.TrimSpace,
    "trimLeft":     strings.TrimLeft,
    "trimRight":    strings.TrimRight,
    "count":        strings.Count,
    "repeat":       strings.Repeat,
    "equalFold":    strings.EqualFold,
    "splitN":       strings.SplitN,
    "splitAfter":   strings.SplitAfter,
    "splitAfterN":  strings.SplitAfterN,
    "fields":       strings.Fields,
    "toTitle":      strings.ToTitle,
    "toSnakeCase":  ToSnakeCase,
    "toCamelCase":  ToCamelCase,
    "toKebabCase":  ToKebabCase,
    "toPascalCase": ToPascalCase,
    "default":      defaultVal,
}func ToCamelCase(s string) stringToCamelCase converts a string to CamelCase.
func ToKebabCase(s string) stringToKebabCase converts a string to kebab-case.
func ToPascalCase(s string) stringToPascalCase converts a string to PascalCase.
func ToSnakeCase(s string) stringToSnakeCase converts a string to snake_case.
DefaultGitClient provides a default implementation for the GitClient interface.
type DefaultGitClient struct {
    Token   string
    BaseURL string
}func NewDefaultGitClient(defaultBranch, token string) *DefaultGitClientNewDefaultGitClient creates a new DefaultGitClient with the optional defaultBranch and token.
func (d *DefaultGitClient) Checkout(path, branch string) errorCheckout checks out a branch in a Git repository.
func (d *DefaultGitClient) Clone(host, owner, repo, dest string) errorClone clones a Git repository to the given destination.
DepInfo contains information about an embed URL.
type DepInfo struct {
    Host  string
    Owner string
    Repo  string
    Path  string
    Block string
    Tag   string
}func ParseDepURL(rawURL string) (*DepInfo, error)ParseDepURL is a parsed embed URL.
Executor is a wrapper around the template.Template type
type Executor struct {
    *template.Template
    git GitClient
}func NewExecutor(client GitClient) *ExecutorNew returns a new Executor
func (e *Executor) EmbedFunc() func(remotePath string, data interface{}) (string, error)EmbedFunc returns a template function that can be used to process and embed a template from a remote git repository. EmbedFunc allows embedding content from a remote repository directly into a Go template.
Steps to use:
- Add the function to the FuncMap.
 - Use the following syntax within your template:
{{ embed "<host>/<owner>/<repo>/<path>@<tag_or_hash_or_branch>" . }} {{ embed "<host>/<owner>/<repo>#<block>@<tag_or_hash_or_branch>" . }} 
Placeholders:
<host>: Repository hosting service (e.g., "github.com").<owner>: Repository owner or organization.<repo>: Repository name.<path>: Path to the desired file or directory within the repository.<block>: Specific template block name.<tag_or_hash_or_branch>: Specific Git reference (tag, commit hash, or branch name).
func (e *Executor) ImportFunc(destPath string) func(repoAndTag, path string, data interface{}) (string, error)ImportFunc returns a function that can be used as a template function to import and process a template from a remote git repository. ImportFunc allows embedding content from a remote repository into a Go template.
Steps to use:
- Add the function to the FuncMap.
 - Use the following syntax within your template:
`{{ import "<host>/<owner>/<repo>/<path>@<tag_or_hash_or_branch>" "<path_to_genrate_files>" . }} `{{ import "<host>/<owner>/<repo>/<path>@<tag_or_hash_or_branch>" "<path_to_genrate_files>" . }} 
Placeholders:
<host>: Repository hosting service (e.g., "github.com").<owner>: Repository owner or organization.<repo>: Repository name.<path>: Path to the desired file or directory within the repository.<tag_or_hash_or_branch>: Specific Git reference (tag, commit hash, or branch name).
func (e *Executor) ParsePath(inputPath string) errorParsePath parses the given path
func (e Executor) Render(name string, data interface{}) (string, error)Render executes the template with the given data
func (e Executor) StringRender(templateString string, data interface{}) (string, error)StringRender renders the given template string with the given data
func (e *Executor) WalkAndProcessDir(inputDir, outputDir string, data interface{}) errorWalkAndProcessDir processes all files in a directory with the given data. If walkFunc is provided, it's called for each file and directory without writing the file to disk.
GitClient is an interface that abstracts Git operations.
type GitClient interface {
    Clone(host, owner, repo, dest string) error
    Checkout(path, branch string) error
    DefaultBranch() string
}