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

View File

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