diff --git a/app/main.go b/app/main.go index 61ea2a4..9edfa4f 100644 --- a/app/main.go +++ b/app/main.go @@ -105,6 +105,7 @@ func (r *realize) Wdir() string { func (r *realize) Serve(p *cli.Context) { if !p.Bool("no-server") { + r.Server.Open = p.Bool("open") r.Server.Start() } } diff --git a/realize.go b/realize.go index bea8f7b..946cf65 100644 --- a/realize.go +++ b/realize.go @@ -30,6 +30,7 @@ func main() { Usage: "Build and watch file changes", Flags: []cli.Flag{ &cli.BoolFlag{Name: "no-server", Usage: "Enable the web panel"}, + &cli.BoolFlag{Name: "open", Usage: "Automatically opens the web panel"}, }, Action: func(p *cli.Context) error { return app.Handle(app.Run(p)) @@ -48,6 +49,7 @@ func main() { &cli.BoolFlag{Name: "no-bin", Usage: "Disables the installation"}, &cli.BoolFlag{Name: "no-fmt", Usage: "Disables the fmt (go fmt)"}, &cli.BoolFlag{Name: "no-server", Usage: "Disables the web panel"}, + &cli.BoolFlag{Name: "open", Usage: "Automatically opens the web panel"}, &cli.BoolFlag{Name: "test", Value: false, Usage: "Enables the tests"}, &cli.BoolFlag{Name: "config", Value: false, Usage: "Take the defined settings if exist a Configuration file."}, }, diff --git a/server/main.go b/server/main.go index 63c94a6..dd30e60 100644 --- a/server/main.go +++ b/server/main.go @@ -16,6 +16,7 @@ type Server struct { Blueprint *c.Blueprint Files map[string]string Sync chan string + Open bool } func render(c echo.Context, path string, mime int) error { @@ -82,7 +83,9 @@ func (s *Server) Start() { //e.GET("/ws", standard.WrapHandler(s.projects())) e.GET("/ws", standard.WrapHandler(s.projects())) go e.Run(standard.New(":5000")) - Open("http://localhost:5000") + if(s.Open) { + Open("http://localhost:5000") + } } // The WebSocket for projects list