Skip to content

Commit

Permalink
Add --path flag to open:local
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikac committed Jan 27, 2022
1 parent 9a94a52 commit d5e0e1b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion commands/openers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package commands

import (
"fmt"
"strings"

"github.com/skratchdot/open-golang/open"
"github.com/symfony-cli/console"
Expand All @@ -45,6 +46,10 @@ var projectLocalOpenCmd = &console.Command{
Usage: "Open the local project in a browser",
Flags: []console.Flag{
dirFlag,
&console.StringFlag{
Name: "path",
Usage: "Default path which the project should open on",
},
},
Action: func(c *console.Context) error {
projectDir, err := getProjectDir(c.String("dir"))
Expand All @@ -55,7 +60,11 @@ var projectLocalOpenCmd = &console.Command{
if !pidFile.IsRunning() {
return console.Exit("Local web server is down.", 1)
}
abstractOpenCmd(fmt.Sprintf("%s://127.0.0.1:%d", pidFile.Scheme, pidFile.Port))
abstractOpenCmd(fmt.Sprintf("%s://127.0.0.1:%d/%s",
pidFile.Scheme,
pidFile.Port,
strings.TrimLeft(c.String("path"), "/"),
))
return nil
},
}
Expand Down

0 comments on commit d5e0e1b

Please sign in to comment.