@@ -110,21 +110,23 @@ func main() {
110
110
Name : "ls" ,
111
111
Aliases : []string {"list" },
112
112
Usage : "list all available files" ,
113
- Action : func (c * cli.Context ) {
113
+ Action : func (c * cli.Context ) error {
114
114
availableGitignores , err := availableFiles ()
115
115
if err != nil {
116
116
log .Fatal (err )
117
+ return err
117
118
}
118
119
fmt .Printf ("%d supported .gitignore files:\n " , len (availableGitignores ))
119
120
sort .Strings (availableGitignores )
120
121
fmt .Printf ("%s\n " , strings .Join (availableGitignores , ", " ))
122
+ return nil
121
123
},
122
124
},
123
125
{
124
126
Name : "u" ,
125
127
Aliases : []string {"update" },
126
128
Usage : "update all available gitignore files" ,
127
- Action : func (c * cli.Context ) {
129
+ Action : func (c * cli.Context ) error {
128
130
fmt .Println ("Updating gitignore files.." )
129
131
err := RemoveContents (dataPath )
130
132
if err != nil {
@@ -133,19 +135,22 @@ func main() {
133
135
err = DownloadFiles (gitignoreUrl , dataPath )
134
136
if err != nil {
135
137
log .Fatal (err )
138
+ return err
136
139
}
140
+ return nil
137
141
},
138
142
},
139
143
{
140
144
Name : "g" ,
141
145
Aliases : []string {"generate" },
142
146
Usage : "generate gitignore files" ,
143
- Action : func (c * cli.Context ) {
147
+ Action : func (c * cli.Context ) error {
144
148
if c .NArg () != 1 {
145
149
cli .ShowAppHelp (c )
146
150
} else {
147
151
generate (c .Args ()[0 ])
148
152
}
153
+ return nil
149
154
},
150
155
},
151
156
}
0 commit comments