registry

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package registry provides template registry management functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata added in v0.3.1

type Metadata struct {
	Templates map[string]TemplateEntry `json:"templates" toml:"templates"`
	Updated   time.Time                `json:"updated" toml:"updated"`
}

Metadata stores registry information

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages local templates

func NewRegistry

func NewRegistry() (*Registry, error)

NewRegistry creates a new template registry

func (*Registry) Add

func (r *Registry) Add(name, sourcePath, description, templateType string) error

Add adds a template to the registry

func (*Registry) Get

func (r *Registry) Get(name string) (string, error)

Get returns the path to a template

func (*Registry) List

func (r *Registry) List() ([]TemplateEntry, error)

List returns all templates in the registry

func (*Registry) Remove

func (r *Registry) Remove(name string, backup bool, backupDir string) error

Remove removes a template from the registry

type TemplateConfig

type TemplateConfig struct {
	Name        string             `toml:"name,omitempty"`
	Description string             `toml:"description,omitempty"`
	Version     string             `toml:"version,omitempty"`
	Author      string             `toml:"author,omitempty"`
	Type        string             `toml:"type,omitempty"`
	Variables   []TemplateVariable `toml:"variables,omitempty"`
	Ignore      []string           `toml:"ignore,omitempty"`
	Tags        []string           `toml:"tags,omitempty"`
}

TemplateConfig represents the ason.toml configuration

type TemplateEntry

type TemplateEntry struct {
	Name        string    `json:"name" toml:"name"`
	Path        string    `json:"path" toml:"path"`
	Description string    `json:"description" toml:"description"`
	Source      string    `json:"source" toml:"source"`
	Type        string    `json:"type" toml:"type"`
	Size        int64     `json:"size" toml:"size"`
	Files       int       `json:"files" toml:"files"`
	Added       time.Time `json:"added" toml:"added"`
	Variables   []string  `json:"variables,omitempty" toml:"variables,omitempty"`
}

TemplateEntry represents a template in the registry

type TemplateVariable

type TemplateVariable struct {
	Name        string      `toml:"name"`
	Description string      `toml:"description,omitempty"`
	Required    bool        `toml:"required,omitempty"`
	Default     interface{} `toml:"default,omitempty"`
	Type        string      `toml:"type,omitempty"`
	Options     []string    `toml:"options,omitempty"`
	Example     string      `toml:"example,omitempty"`
}

TemplateVariable represents a template variable definition

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL