fast run
This commit is contained in:
parent
227baccdd3
commit
441d075da9
@ -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")),
|
||||
|
@ -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() {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user