-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (51 loc) · 1.02 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"github.com/codegangsta/cli"
"github.com/spyzhov/goat/action"
"log"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "Goat"
app.HelpName = "goat"
app.Usage = "golang: application template"
app.Description = "Goat is golang application template generator"
app.Version = "0.0.1"
app.Authors = []cli.Author{
{Name: "S.Pyzhov", Email: "turin.tomsk@gmail.com"},
}
app.Before = func(context *cli.Context) error {
return nil
}
app.Action = func(c *cli.Context) error {
a := action.New(c)
return a.Invoke()
}
app.EnableBashCompletion = true
app.BashComplete = func(c *cli.Context) {
}
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug",
Usage: "Enable debug mode",
},
cli.StringFlag{
Name: "path",
Usage: "Path to the output directory",
Value: getPath(),
},
}
app.Flags = append(app.Flags, []cli.Flag{}...)
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
func getPath() string {
dir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
return dir
}