flags updated

This commit is contained in:
alessio 2016-08-22 18:08:41 +02:00
parent 4bcaafa825
commit 209cbc8974
2 changed files with 17 additions and 17 deletions

20
main.go
View File

@ -66,11 +66,11 @@ func main() {
Name: "fast", Name: "fast",
Usage: "Build and watch file changes for a single project without any config file", Usage: "Build and watch file changes for a single project without any config file",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"}, &cli.BoolFlag{Name: "build", Value: false, Usage: "Enables the build"},
&cli.BoolFlag{Name: "run", Usage: "Disable go run"}, &cli.BoolFlag{Name: "norun", Usage: "Disables the run"},
&cli.BoolFlag{Name: "bin", Usage: "Disable go install"}, &cli.BoolFlag{Name: "nobin", Usage: "Disables the installation"},
&cli.BoolFlag{Name: "fmt", Usage: "Disable gofmt"}, &cli.BoolFlag{Name: "nofmt", Usage: "Disables the fmt (go fmt)"},
&cli.BoolFlag{Name: "config", Value: false, Usage: "If there is a config file with a project for the current directory take that configuration"}, &cli.BoolFlag{Name: "config", Value: false, Usage: "Take the defined settings if exist a config file."},
}, },
Action: func(p *cli.Context) error { Action: func(p *cli.Context) error {
y := r.New(p) y := r.New(p)
@ -88,12 +88,12 @@ func main() {
Aliases: []string{"a"}, Aliases: []string{"a"},
Usage: "Add another project", Usage: "Add another project",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: wd(), Usage: "Project name \t"}, &cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: wd(), Usage: "Project name"},
&cli.StringFlag{Name: "path", Aliases: []string{"b"}, Value: "/", Usage: "Project base path \t"}, &cli.StringFlag{Name: "path", Aliases: []string{"b"}, Value: "/", Usage: "Project base path"},
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"}, &cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"},
&cli.BoolFlag{Name: "run", Usage: "Disable go run"}, &cli.BoolFlag{Name: "norun", Usage: "Disables the run"},
&cli.BoolFlag{Name: "bin", Usage: "Disable go install"}, &cli.BoolFlag{Name: "nobin", Usage: "Disables the installation"},
&cli.BoolFlag{Name: "fmt", Usage: "Disable gofmt"}, &cli.BoolFlag{Name: "nofmt", Usage: "Disables the fmt (go fmt)"},
}, },
Action: func(p *cli.Context) error { Action: func(p *cli.Context) error {
y := r.New(p) y := r.New(p)

View File

@ -55,9 +55,9 @@ func New(params *cli.Context) *Config {
Name: nameParam(params), Name: nameParam(params),
Path: slash(params.String("path")), Path: slash(params.String("path")),
Build: params.Bool("build"), Build: params.Bool("build"),
Bin: boolParam(params.Bool("bin")), Bin: boolParam(params.Bool("nobin")),
Run: boolParam(params.Bool("run")), Run: boolParam(params.Bool("norun")),
Fmt: boolParam(params.Bool("fmt")), Fmt: boolParam(params.Bool("nofmt")),
Watcher: Watcher{ Watcher: Watcher{
Paths: watcherPaths, Paths: watcherPaths,
Ignore: watcherIgnores, Ignore: watcherIgnores,
@ -115,7 +115,7 @@ func (h *Config) Create() error {
if err != nil { if err != nil {
return err return err
} }
return ioutil.WriteFile(h.file, y, 0755) return ioutil.WriteFile(h.file, y, 0655)
} }
// Add another project // Add another project
@ -126,9 +126,9 @@ func (h *Config) Add(params *cli.Context) error {
Name: nameParam(params), Name: nameParam(params),
Path: slash(params.String("path")), Path: slash(params.String("path")),
Build: params.Bool("build"), Build: params.Bool("build"),
Bin: boolParam(params.Bool("bin")), Bin: boolParam(params.Bool("nobin")),
Run: boolParam(params.Bool("run")), Run: boolParam(params.Bool("norun")),
Fmt: boolParam(params.Bool("fmt")), Fmt: boolParam(params.Bool("nofmt")),
Watcher: Watcher{ Watcher: Watcher{
Paths: watcherPaths, Paths: watcherPaths,
Exts: watcherExts, Exts: watcherExts,