cli options for open the web panel in browser
This commit is contained in:
parent
53841e02bd
commit
6fe4d62a80
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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."},
|
||||
},
|
||||
|
|
|
@ -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"))
|
||||
if(s.Open) {
|
||||
Open("http://localhost:5000")
|
||||
}
|
||||
}
|
||||
|
||||
// The WebSocket for projects list
|
||||
|
|
Loading…
Reference in New Issue