From 820ed2055b2cad0fd945abc11c4d0a580e382dc4 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 10 Mar 2025 11:19:30 +0000 Subject: [PATCH] return err from listTemplates --- cmd/gignore/main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/gignore/main.go b/cmd/gignore/main.go index 313d201..b650d2b 100644 --- a/cmd/gignore/main.go +++ b/cmd/gignore/main.go @@ -50,7 +50,9 @@ func main() { client := gignore.New(gignore.WithTemplateDirectory(templateDir)) if list { - listTemplates(client) + if err := listTemplates(client); err != nil { + log.Fatalf("failed to list templates: %v", err) + } return } @@ -68,12 +70,13 @@ func main() { fmt.Printf("√ created %s .gitignore file\n", args[0]) } -func listTemplates(client *gignore.GignoreClient) { +func listTemplates(client *gignore.GignoreClient) error { templates, err := client.List() if err != nil { - log.Fatalf("failed to list templates: %v", err) + return err } for _, template := range templates { fmt.Println(template) } + return nil }