rename registry functions

This commit is contained in:
onyx-and-iris 2025-03-12 12:54:13 +00:00
parent f0b64e3a75
commit c2b7dfcb18
2 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ func New(options ...Option) *Client {
// List returns a list of available .gitignore templates.
func (c *Client) List() ([]string, error) {
return c.registry.ListTemplates()
return c.registry.List()
}
// Create generates a .gitignore file from the specified template.
@ -60,7 +60,7 @@ func (c *Client) Create(template string) error {
log.Infof("template '%s' found in default gitignoreio registry", template)
}
content, err := c.registry.GetTemplate(template)
content, err := c.registry.Get(template)
if err != nil {
return err
}

View File

@ -41,8 +41,8 @@ func (t *TemplateRegistry) Contains(name string) (bool, error) {
return true, nil
}
// GetTemplate retrieves the content of the gitignore template with the given name.
func (t *TemplateRegistry) GetTemplate(name string) ([]byte, error) {
// Get retrieves the content of the gitignore template with the given name.
func (t *TemplateRegistry) Get(name string) ([]byte, error) {
data, err := fs.ReadFile(t.templates, t.filePath(name))
if err != nil {
return nil, err
@ -50,8 +50,8 @@ func (t *TemplateRegistry) GetTemplate(name string) ([]byte, error) {
return data, nil
}
// ListTemplates lists all the gitignore templates in the registry.
func (t *TemplateRegistry) ListTemplates() ([]string, error) {
// List lists all the gitignore templates in the registry.
func (t *TemplateRegistry) List() ([]string, error) {
var paths []string
err := fs.WalkDir(