This commit is contained in:
alessio 2016-08-21 23:31:16 +02:00
parent a555c2c0ff
commit 297e867d52
1 changed files with 19 additions and 6 deletions

23
main.go
View File

@ -54,16 +54,29 @@ func main() {
{ {
Name: "run", Name: "run",
Usage: "Build and watch file changes", Usage: "Build and watch file changes",
Action: func(p *cli.Context) error {
y := r.New(p)
return handle(y.Watch())
},
Before: func(c *cli.Context) error {
header()
return nil
},
},
{
Name: "fast",
Usage: "Build and watch file changes for a single project without any config file",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{Name: "fast", Usage: "Run the project of your working directory"}, &cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"},
&cli.BoolFlag{Name: "run", Usage: "Disable go run"},
&cli.BoolFlag{Name: "bin", Usage: "Disable go install"},
&cli.BoolFlag{Name: "fmt", Usage: "Disable gofmt"},
&cli.BoolFlag{Name: "config", Usage: "If there is a config file with a project for the current directory take that configuration"},
}, },
Action: func(p *cli.Context) error { Action: func(p *cli.Context) error {
y := r.New(p) y := r.New(p)
if p.Bool("fast") {
y.Projects[0].Path = wd() y.Projects[0].Path = wd()
return handle(y.Fast()) return handle(y.Fast(p))
}
return handle(y.Watch())
}, },
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
header() header()