mirror of
https://github.com/onyx-and-iris/gignore.git
synced 2025-04-15 18:13:54 +01:00
no need to pass client around
This commit is contained in:
parent
2fa49d0dd0
commit
6adea84322
@ -5,7 +5,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onyx-and-iris/gignore"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -25,7 +24,7 @@ Example:
|
||||
}
|
||||
|
||||
for _, arg := range args {
|
||||
createTemplate(client, arg)
|
||||
createTemplate(arg)
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -36,7 +35,7 @@ func init() {
|
||||
}
|
||||
|
||||
// createTemplate creates a new .gitignore file using the specified template.
|
||||
func createTemplate(client *gignore.Client, template string) {
|
||||
func createTemplate(template string) {
|
||||
err := client.Create(template)
|
||||
cobra.CheckErr(err)
|
||||
fmt.Printf("√ created %s .gitignore file\n", template)
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/onyx-and-iris/gignore"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -20,7 +19,7 @@ You can use this command to quickly find all available .gitignore templates.
|
||||
Example:
|
||||
gignore --root=<path> list`,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
if err := listTemplates(client); err != nil {
|
||||
if err := listTemplates(); err != nil {
|
||||
cobra.CheckErr(err)
|
||||
}
|
||||
},
|
||||
@ -33,7 +32,7 @@ func init() {
|
||||
|
||||
// listTemplates retrieves and prints all .gitignore templates available from the gignore client.
|
||||
// It takes a gignore.Client as a parameter and returns an error if the operation fails.
|
||||
func listTemplates(client *gignore.Client) error {
|
||||
func listTemplates() error {
|
||||
templates, err := client.List()
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user