diff --git a/realize/config.go b/realize/config.go index 69a85bd..5e08dc7 100644 --- a/realize/config.go +++ b/realize/config.go @@ -21,7 +21,7 @@ type Config struct { func nameParam(params *cli.Context) string { var name string if params.String("name") == "" { - name = params.String("base") + name = params.String("path") } else { name = params.String("name") } @@ -43,7 +43,7 @@ func New(params *cli.Context) *Config { Projects: []Project{ { Name: nameParam(params), - Path: params.String("base"), + Path: params.String("path"), Build: params.Bool("build"), Bin: boolParam(params.Bool("bin")), Run: boolParam(params.Bool("run")), @@ -114,7 +114,7 @@ func (h *Config) Add(params *cli.Context) error { if err == nil { new := Project{ Name: nameParam(params), - Path: params.String("base"), + Path: params.String("path"), Build: params.Bool("build"), Bin: boolParam(params.Bool("bin")), Run: boolParam(params.Bool("run")), diff --git a/realize/watcher.go b/realize/watcher.go index 3dfbd08..5c9b765 100644 --- a/realize/watcher.go +++ b/realize/watcher.go @@ -39,6 +39,26 @@ func (h *Config) Watch() error { return err } +// Fast method run a project from his working directory without makes a config file +func (h *Config) Fast() error { + fast := h.Projects[0] + // Takes the values from config if wd path match with another path + if err := h.Read(); err == nil { + for _, val := range h.Projects { + fmt.Println(val) + if fast.Path == val.Path { + fast = val + } + } + } + wg.Add(1) + fast.Name = fast.Path + fast.Path = "" + go fast.Watching() + wg.Wait() + return nil +} + // Watching method is the main core. It manages the livereload and the watching func (p *Project) Watching() {